[R] About Pearson correlation functions

Mahmood Naderan-Tahan m@hmood@n@der@n @end|ng |rom ugent@be
Sun May 30 18:18:22 CEST 2021


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?


	[[alternative HTML version deleted]]

More information about the R-help mailing list