library("dendextend")
set.seed(23235)
ss <- sample(1:150, 5)
# Getting the dend object
dend25 <- iris[ss, -5] %>%
dist() %>%
hclust() %>%
as.dendrogram() %>%
set("labels", letters[1:5])
par(mfrow = c(1,4))
plot(dend25)
plot(collapse_labels(dend25, c("d", "e")))
plot(collapse_labels(dend25, c("c", "d", "e")))
plot(collapse_labels(dend25, c("c", "d", "e"), squashed_original_height=TRUE))
Run the code above in your browser using DataLab