find.leaves {rare} | R Documentation |
The function recursively finds all leaves that are descendants of a
node in an hclust
tree.
find.leaves(ind, merge)
ind |
Index of the tree node. For an |
merge |
A ( |
Returns a sequence of indices for descendant leaves
in the leaf set {1, ..., p}. Unlike the notation used in
ind
, we use positive integers to denote leaves here.
## Not run: hc <- hclust(dist(USArrests), "ave") # Descendant leaves of the 10th leaf (should be iteself) find.leaves(-10, hc$merge) # Descendant leaves of the 10th interior node find.leaves(10, hc$merge) # Descendant leaves of the root (should be all leaves) ind_root <- nrow(hc$merge) all.equal(find.leaves(ind_root, hc$merge), hc$order) ## End(Not run)