| find_dendrogram {dendextend} | R Documentation |
Given a dendrogram object, the function performs a recursive DFS algorithm to determine
the subdendrogram which is composed of all indicated labels. The labels
which should compose the subdendrogram are marked as TRUE in the logical
vector of length nleaves(dend)
find_dendrogram(dend, selected_labels)
dend |
a dendrogram object |
selected_labels |
logical vector with TRUE values at positions of members which should be included in the resulting subdendrogram |
A subdendrogram composed of only members indicated in the given logical vector clusters.
## Not run:
# define dendrogram object to play with:
dend <- iris[,-5] %>% dist %>% hclust %>% as.dendrogram %>%
set("labels_to_character") %>% color_branches(k=5)
first.subdend.only <- cutree(dend, 4) == 1
sub.dend <- find_dendrogram(dend, first.subdend.only)
# Plotting the result
par(mfrow=c(1,2))
plot(dend, main = "Original dendrogram")
plot(sub.dend, main = "First subdendrogram")
## End(Not run)