getDepths {phyloTop} | R Documentation |
Find the depth of each node
Description
Determines the depth of each node, defined as the number of steps from the root.
(So the root has depth zero, its children have depth one, etc.)
The output is given as a list of two vectors: tipDepths
gives the depths of the tips, and nodeDepths
gives the depths of the internal nodes.
This replaces the deprecated dists
function.
The code is based on that used in the function computeHeights
in package treeCentrality
.
Usage
getDepths(tree)
Arguments
tree |
a tree of class |
Value
A list of two vectors: tipDepths
gives the depths of the tips, and nodeDepths
gives the depths of the internal nodes.
Author(s)
Michelle Kendall michelle.louise.kendall@gmail.com
See Also
Examples
## Find the node depths in a random tree:
tree <- rtree(20)
treeDepths <- getDepths(tree)
## Plot tree with node depths labelled:
tree$tip.label <- treeDepths$tipDepths
tree$node.label <- treeDepths$nodeDepths
plot(tree, show.node.label=TRUE)
[Package phyloTop version 2.1.2 Index]