[R] Interpreting the result of 'cutree' from hclust/heatmap.2
David Carlson
dcarlson at tamu.edu
Thu Aug 22 16:20:06 CEST 2013
You specified 10 cuts to the dendrogram (all possible) so each
column represents the cluster membership for that number of
clusters. Column 1 is all ones because all rows belong to a
single cluster and in column 10 all the rows belong to different
clusters. For g9-9, 8 means that g9 belongs to cluster 8 when
there are 9 clusters (g2 and g4 belong to the same cluster) in
column 9.
-------------------------------------
David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77840-4352
-----Original Message-----
From: r-help-bounces at r-project.org
[mailto:r-help-bounces at r-project.org] On Behalf Of Gundala
Viswanath
Sent: Wednesday, August 21, 2013 9:05 PM
To: r-help at stat.math.ethz.ch
Subject: [R] Interpreting the result of 'cutree' from
hclust/heatmap.2
I have the following code that perform hiearchical clustering
and plot
them in heatmap.
__
library(gplots)
set.seed(538)
# generate data
y <- matrix(rnorm(50), 10, 5, dimnames=list(paste("g", 1:10,
sep=""),
paste("t", 1:5, sep="")))
# the actual data is much larger that the above
# perform hiearchical clustering and plot heatmap
test <- heatmap.2(y)
__
What I want to do is to print the cluster member from each
hierarchy
of in the plot. I'm not sure what's the good way to do it.
I tried this:
cutree(as.hclust(test$rowDendrogram), 1:dim(y)[1])
But having problem in interpreting the result.
What's the meaning of each value in the matrix?
For example g9-9=8 . What does 8 mean here?
1 2 3 4 5 6 7 8 9 10
g1 1 1 1 1 1 1 1 1 1 1
g2 1 2 2 2 2 2 2 2 2 2
g3 1 2 2 3 3 3 3 3 3 3
g4 1 2 2 2 2 2 2 2 2 4
g5 1 1 1 1 1 1 1 4 4 5
g6 1 2 3 4 4 4 4 5 5 6
g7 1 2 2 2 2 5 5 6 6 7
g8 1 2 3 4 5 6 6 7 7 8
g9 1 2 3 4 4 4 7 8 8 9
g10 1 2 3 4 5 6 6 7 9 10
Your expert advice will be greatly appreciated.
- G.V.
______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible
code.
More information about the R-help
mailing list