这有点继续我之前的问题R - Phylogram labels to vector
我有来自分层聚类分析的phylogram
select company, list(currency_total || currency, '+') as total_amount
from
(
select company, currency, sum(amount) as currency_total
from mytable
group by company, currency;
) totals
group by company
order by company;
然后我想用#Create data
df <- data.frame(x1=rnorm(10),x2=rnorm(10),x3=rnorm(10),x4=rnorm(10),
x5=rnorm(10),x6=rnorm(10),x7=rnorm(10),x8=rnorm(10),x9=rnorm(10),
x10=rnorm(10))
tdf <- t(df)
#Hierarchical clustering and label extraction
x <- hclust(dist(tdf),method="complete")
xlabels <- with(x,labels[order])
#Plot phylogram
library(ape)
plot(as.phylo(x),direction="downwards")
绘制相关热图,我希望用corrplot
(phylogram标签)对变量进行排序。
我试过
xlabels
但它不起作用并给我以下错误
特征(corr)中的误差:特征中的非方矩阵
有谁知道如何解决这个问题?