Skip to content
Prev 200752 / 398503 Next

question about function heatmap

On Tue, Nov 17, 2009 at 17:03, Waverley @ Palo Alto
<waverley.paloalto at gmail.com> wrote:
The heatmap function does not return the full clustering information.
If you look in the help, you'll see that the rows and columns are
reordered by:
dd <- as.dendrogram(hclustfun(distfun(X)))
so you need to run your own clustering separately:

x <- matrix(rnorm(100),ncol=10,dimnames=list(paste("gene",1:10),paste("sample",1:10)))
x.hclust <- hclust(dist(x))
plot(as.dendrogram(x.hclust))
x.ident <- rect.hclust(x.hclust,k=2)
x.ident

To get the sample clusters, transpose the matrix for the distance calculation.