I have produced a heatmap using heatmap in base R, but would like to change the order of the rows appearing in the dendogram. I would like to know how I can alter my code to achieve this. I have tried using the function reorder.dendogram however this doesn't work with my dataframe.
This is the data I'm working with and the code I have used so far
dd <- structure(list(A = c(26, 64, 54, 98, 95),
B = c(63, 64, 26, 82, 3),
C = c(11, 17, 53, 83, 35),
D = c(15, 13, 72, 71, 17),
E = c(94, 19,51, 19, 55),
F = c(89, 47, 49, 15, 68)),
.Names = c("A", "B", "C", "D", "E", "F"),
row.names = c(NA, 5L), class = "data.frame")
# A B C D E F
# 1 26 63 11 15 94 89
# 2 64 64 17 13 19 47
# 3 54 26 53 72 51 49
# 4 98 82 83 71 19 15
# 5 95 35 35 17 55 68
heatmap(t(dd),
scale = 'none',
col = brewer.pal(6, 'RdPu'),
xlab = 'Cluster',
main = "Heatmap")
My desired output would be the clusters along X axis being ordered 1 to 5 rather than the current order. How can I alter my code to achieve this?