list.ancestors {TotalCopheneticIndex} | R Documentation |
List ancestors
Description
Reports the ancestors of a given node. Now simply a wrapper for TreeTools::ListAncestors()
.
Usage
list.ancestors(parent, child, node)
Arguments
parent |
the 'parent' column of the edges property of a tree of class |
child |
the 'child' column of the edges property of a tree of class |
node |
the number of the node or tip whose ancestors are required. |
Details
To observe the number of a node or tip, use
plot(tree); nodelabels(); tiplabels();
Value
Returns a vector of the numbers of the nodes ancestral to the given node
, including the root node.
Author(s)
Martin R. Smith
See Also
phangorn:::Ancestors
, a less efficient implementation on which this code is based.
Examples
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)
[Package TotalCopheneticIndex version 2.0.1 Index]