Identify vertices retained when leaves are dropped
Original tree of class
a logical vector stating whether each leaf should be retained, in a
sequence corresponding to
a character vector listing the leaf labels to retain; or
a numeric vector listing the indices of leaves to retain.
Optional character vector naming the leaves of
keptTips is not logical. Inferred from
tree if unspecified.
master <- BalancedTree(12) master <- Preorder(master) # Nodes must be listed in Preorder sequence plot(master) nodelabels() allTips <- master[["tip.label"]] keptTips <- sample(allTips, 8) plot(KeepTip(master, keptTips)) kept <- KeptVerts(master, allTips %in% keptTips) map <- which(kept) # Node `i` in the reduced tree corresponds to node `map[i]` in the original.