findAncestor {TreeSummarizedExperiment} | R Documentation |
findAncestor
finds the ancestor in the nth generation above
specified nodes.
findAncestor(tree, node, level, use.alias = FALSE)
tree |
A phylo object |
node |
A vector of node numbers or node labels |
level |
A vector of numbers to define nth generation before the specified nodes |
use.alias |
A logical value, TRUE or FALSE. The default is FALSE, and
the node label would be used to name the output; otherwise, the alias of
node label would be used to name the output. The alias of node label is
created by adding a prefix |
A vector of nodes. The numeric value is the node number, and the
vector name is the corresponding node label. If a node has no label, it
would have NA as name when use.alias = FALSE
, and have the alias of
node label as name when use.alias = TRUE
.
Ruizhu Huang
library(ggtree) data(tinyTree) ggtree(tinyTree, branch.length = 'none') + geom_text2(aes(label = label), color = "darkorange", hjust = -0.1, vjust = -0.7) + geom_text2(aes(label = node), color = "darkblue", hjust = -0.5, vjust = 0.7) findAncestor(tree = tinyTree, node = c(18, 13), level = 1)