Ancestors {phangorn} | R Documentation |
Functions for describing relationships among phylogenetic nodes.
Ancestors(x, node, type=c("all","parent")) Children(x, node) Siblings(x, node, include.self=FALSE) Descendants(x, node, type=c("tips","children","all"))
x |
a tree (a phylo object). |
node |
an integer corresponding to a node ID |
type |
specify whether to return just direct ancestor / parents or all |
include.self |
whether to include self in list of siblings |
a vector containing the indices of the nodes.
these functions are inspired by treewalk
in phylobase package
tree = rtree(10) plot(tree, show.tip.label = FALSE) nodelabels() tiplabels() Ancestors(tree, 1, "all") Children(tree, 11) Descendants(tree, 11, "tips") Siblings(tree, 3)