list.ancestors: List ancestors

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Reports the ancestors of a given node. Now simply a wrapper for TreeTools::ListAncestors().

Usage

1
list.ancestors(parent, child, node)

Arguments

parent

the 'parent' column of the edges property of a tree of class phylo;

child

the 'child' column of the edges property of a tree of class phylo;

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

1
2
3
4
5
  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)

Example output

[1] 9 8 7 6

TotalCopheneticIndex documentation built on June 23, 2021, 5:06 p.m.