I have created a heatmap in R using
pheatmap as seen below. I would like to extract the clusters outlined in black, due to the patterns identified within. The problem I have is that the distances are not in the order I wish to extract the clusters. Is there a smart way I can do this whilst still keeping the information contained? I am using Ward D2 clustering method.
I have so far used:
df$clust <- cbind(df, cluster = cutree(pat$tree_col, k = 4))
but of course this goes by distance. Thanks!