powered by
Reports the ancestors of a given node. Now simply a wrapper for TreeTools::ListAncestors().
TreeTools::ListAncestors()
list.ancestors(parent, child, node)
the 'parent' column of the edges property of a tree of class phylo;
phylo
the 'child' column of the edges property of a tree of class phylo;
the number of the node or tip whose ancestors are required.
Returns a vector of the numbers of the nodes ancestral to the given node, including the root node.
node
To observe the number of a node or tip, use plot(tree); nodelabels(); tiplabels();
plot(tree); nodelabels(); tiplabels();
phangorn:::Ancestors, a less efficient implementation on which this code is based.
phangorn:::Ancestors
# NOT RUN { tree <- ape::read.tree(text='(1, (2, (3, (4, 5))));') edge <- tree$edge parent <- tree$edge[, 1] child <- tree$edge[, 2] list.ancestors(parent, child, 4) # }
Run the code above in your browser using DataLab