在R中输入cor.test(X,Y,method="pearson"),得到如下结果:
Pearson's product-moment correlation
data: X and Y
t = 96.5086, df = 499, p-value < 2.2e-16
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
0.9693722 0.9783470
sample estimates:
cor
0.9742426
想把里面的0.9742426 单独提取出来,应该怎么做?
我知道cor(X,Y)可以直接得到0.9742426 的数值形式,但是因为我将来还会用到method="spearman"或是"kendall",因此在这里还请各位大神解惑。