I tried your code it works perfectly fine with complex heatmap But when I doing the same with pheatmap basically this is what im doing
out <- pheatmap(data,
color=myColor,
breaks = myBreaks,
show_rownames = T,cluster_cols=T,cluster_rows=T,
cex=.5,clustering_distance_rows = "euclidean",cex=.5,
clustering_distance_cols = "euclidean", clustering_method = "complete",border_color = FALSE)
res <- data[c(out$tree_row[["order"]]),out$tree_col[["order"]]]
when i View(res) Im not getting individual cluster which i did get for complexheatmap rather its complete list..
What function are you using ? There are many ways of doing heatmaps in R. Depending on the function, the easiest way may be to use the same clustering function with the same parameters as used in your heatmap function, e.g. heatmap() uses hclust() by default. Note that for hierachical clustering, you would need to cut the tree to get clusters.
I edited the title of this post so it is easy to find it in future by others.