You didn't say how the values differed. If one in the plot is a rounded
version of the other then adding the ggpur::ggscatter() argument
cor.coeff.args=list(digits=7)
will fix things up.
-Bill
On Sun, May 30, 2021 at 9:18 AM Mahmood Naderan-Tahan <
mahmood.naderan at ugent.be> wrote:
> Hi
>
> Maybe this is not directly related to R, but I appreciate you can help me
> with an idea. I use the following ggscatter function to plot a Pearson
> correlation Coefficient and it works fine. In the chart I see both R-value
> and P-value.
>
>
> ggscatter(mydata, x = "V1", y = "V2", add =
"reg.line", conf.int > TRUE, cor.coef = TRUE, cor.method =
"pearson")
>
>
> On the other hand, when I use this command
>
>
> res <- cor.test(mydata$V1, mydata$V2, method = "pearson")
>
>
> The R and P values are different from ggscatter.
>
>
> I would like to know:
>
>
> 1- Why they are different?
>
> 2- How to print P and R values of ggscatter on terminal?
>
>
>
> Regards,
> Mahmood
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
[[alternative HTML version deleted]]