Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
试图计算列之间的相关性,但 cor() 函数一次只允许在两列之间进行比较。
> mat <- matrix(c(45,34,1,3,4325,23,1,2,5,7,3,4,32,734,2,53),ncol=4) > mat [,1] [,2] [,3] [,4] [1,] 45 4325 5 32 [2,] 34 23 7 734 [3,] 1 1 3 2 [4,] 3 2 4 53
cor(mat, method = "spearman")
该cor函数默认计算列之间的相关性。我不知道您从哪里获得该corr功能,但似乎cor应该满足您的需求。
cor
corr