【问题标题】:Extract the order list from an ordered correlation matrix: R从有序相关矩阵中提取顺序列表:R
【发布时间】:2017-05-03 22:27:44
【问题描述】:

我创建了一个相关矩阵并使用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)

【问题讨论】:

  • 这个corrMatOrder有一个函数;所以使用corrMatOrder(t(tempCor), order="AOE")

标签: r r-corrplot


【解决方案1】:

试试这个:

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"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-03-15
    • 2020-05-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多