我正在运行一个作弊图,并使用cluster_rows = T
和cluster_cols = T
对列和行进行聚类。
我需要提取报告列ID和行ID的新顺序的向量。下面的脚本
set.seed(123)
df<-data.frame( matrix(sample(30), ncol = 5))
colnames(df)<-LETTERS[1:5]
subj<-c("P1", "P2","P3", "T1", "T2","T3")
rownames(df)<-subj
library(pheatmap)
pheatmap(t(scale(df)), show_colnames = T, show_rownames = T,
cluster_rows = T, cluster_cols = T, legend = TRUE)