Hi there! I am using aheatmap to find some pattern but I need to reorder the dendrogram. I find there is a function called reorder that seems to do this job but I am really having difficulty in understanding it. I tried messing around with 'weights' for reorder, I thought when the anglo.fun = mean it will ignore the size of each cluster than I could just give each cluster a vector of the same number but actually it is NOT!
I tried looking other pages like, https://www.mail-archive.com/r-help@r-project.org/msg195536.html. and there is an example on the man page.
set.seed(123)
x <- rnorm(10)
hc <- hclust(dist(x))
dd <- as.dendrogram(hc)
dd.reorder <- reorder(dd, 10:1)
plot(dd, main = "random dendrogram 'dd'")
>
op <- par(mfcol = 1:2)
plot(dd.reorder, main = "reorder(dd, 10:1)")
plot(reorder(dd, 10:1, agglo.FUN = mean), main = "reorder(dd, 10:1, mean)")
par(op)
Have no idea about how this function works! Really need help.
Hi Kevin, this explanation really helps. But how to flip the dendrogram if I have more than 10 leafs, such as 100? Assign the weights one by one?
Do you literally just want the mirror image of your dendrogram?