这个数据集提供了美国 50 个州在 1997 年人口、收 入、文盲率、预期寿命、谋杀率和高中毕业率、气温以及土地面积的数据。通过数据搜集的信息,想知道哪些因素与谋杀率相关性较高。...计算相关性系数
R 可以计算多种相关系数,包括 Pearson 相关系数、Spearman 相关系数、Kendall 相关系数、偏相关系数等。...例如可以计算基因与表型之间的关联。一般绝对值大于0.5认为相关。...#计算相关性矩阵
colnames(state.x77)
cor.test(state.x77[,5], state.x77[,1])
plot(state.x77[,5], state.x77[,1]...state.x77[,3])
cor.test(state.x77[,5], state.x77[,4])
cor.test(state.x77[,5], state.x77[,4],method = 'spearman