nodeHeights
computes the height above the root for all nodes in the tree. nodeheight
computes the height above the root for a single node.
nodeHeights(tree, ...)
nodeheight(tree, node, ...)
Either a matrix of the same dimensions as tree$edge
containing the height above the root of each node in edge
(for nodeHeights
); or a single positive number (for nodeheight
).
a phylogeny as an object of class "phylo"
.
for nodeheight
, the node for which we want to compute a height above the root (or including the root edge, for root.edge=TRUE
).
optional arguments - presently only root.edge
, a logical value indicating whether or not to include the root edge length in the calculation of node heights.
Liam Revell liam.revell@umb.edu
The function nodeHeights
also gives a handy way to get the total length of the tree from the root to the heighest tip which will be given by max(nodeHeights(tree))
. Generally speaking, nodeHeights
will be faster if the heights of all or a large proportion of nodes is needed, wherease nodeheight
will be faster if the height of one or a small number of nodes are needed.
Revell, L. J. (2012) phytools: An R package for phylogenetic comparative biology (and other things). Methods Ecol. Evol., 3, 217-223.
vcvPhylo
tree<-rtree(10)
X<-nodeHeights(tree)
Run the code above in your browser using DataLab