简体   繁体   English

在R中提取热图的特定成员

[英]extracting specific members of heatmap in R

I generated a heatmap based on a 4500 row x 400 col matrix m: 我基于4500行x 400 col矩阵m生成了一个热图:

hm<-heatmap(m, na.rm=TRUE, col=bluered(256))

So how do I see members of specific clusters? 那么我如何看待特定集群的成员呢? I read a bit and know that I have to use 'cutree()' but I am still not sure how to properly implement it. 我读了一点,知道必须使用'cutree()',但是我仍然不确定如何正确实现它。

Thanks. 谢谢。

hm<-heatmap.2(m, na.rm=TRUE)
clstrs <- cutree(as.hclust(hm$rowDendrogram), 1:dim(m)[1])

And depending on how many clusters you want, you select the right column. 然后根据所需的群集数量,选择合适的列。 Thus if you want 7 clusters: 因此,如果要7个群集:

clstrs[, 7]

Will tell you in which cluster each element belongs. 会告诉您每个元素属于哪个群集。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM