2017-05-03 63 views
1

我创建了一个相关矩阵和使用corrplot功能用下面的代码从有序相关矩阵中提取的顺序列表,R

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功能可按结果

plot

有没有什么办法从这个结果中得到订单清单,即(4,5,1,3,2)

+0

有这个'corrMatOrder'的功能;所以使用'corrMatOrder(t(tempCor),order =“AOE”)' – user20650

回答

0

试试这个:

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"