Reputation: 1258
I have a simlarity matrix as follows:
xx <- cor(matrix(rnorm(650), ncol =25))
I want to cluster this similarity matrix and image in a heatmap. Is the following correct?
yy <- heatmap(1-xx, Rowv=T, scale='none',symm = T,keep.dendro=F,
Here, I am taking 1-xx which is a dissimilarity matrix. Is this the right thing to do, or should it be input in some other way?
Upvotes: 2
Views: 590
Reputation: 1258
I have figured it out upon reading one of the examples in R. Here is what one has to do using the similarity matrix.
hU <- heatmap(xx, Rowv = FALSE, symm = TRUE,
distfun = function(c) as.dist(1 - c),
hclustfun = function(d) hclust(d, method = "single"),
keep.dendro = FALSE)
I hope that this helps someone!
Upvotes: 1