# 基于R计算皮尔逊相关系数
# 函数
基本基本函数 cor.test
## 两组数据读入
x=read.csv("1.csv",header = T)
y=read.csv("2.csv",header = T)
## 计算
cor.test(1,2,method="pearson")
结果
Pearson's product-moment correlationdata: 1 and 2
t = 841, df = 34, p-value <0.0000000000000002
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:1 1
sample estimates:
cor 1
https://www.yebaike.com/22/1570942.html