[R] Interpreting the result of 'cutree' from hclust/heatmap.2

Gundala Viswanath gundalav at gmail.com
Thu Aug 22 04:05:02 CEST 2013


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.



More information about the R-help mailing list