从有序相关矩阵中提取顺序列表:R

Extract the order list from an ordered correlation matrix: R

我创建了一个相关矩阵,并使用 corrplot 函数和以下代码将其可视化

temp<-matrix(rexp(25, rate=.1), ncol=5)
tempCor<-cor(temp)
tempCor <- data.frame(tempCor)
names(tempCor) <- c(1:5)
corrplot(t(tempCor),method="pie",order="AOE")

这是 corrplot 函数的结果

有什么方法可以从这个结果中得到订单列表,即(4,5,1,3,2)

试试这个:

library(corrplot)
set.seed(1234)
temp <- matrix(rexp(25, rate=.1), ncol=5)
tempCor <- cor(temp)
tempCor <- data.frame(tempCor)
names(tempCor) <- c(1:5)
out <- corrplot(t(tempCor),method="pie",order="AOE")
dimnames(out)

这是您要查找的内容:

[[1]]
[1] "5" "1" "3" "4" "2"

[[2]]
[1] "1" "2" "3" "4" "5"