getDepths | R Documentation |
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
.
getDepths(tree)
tree |
a tree of class |
A list of two vectors: tipDepths
gives the depths of the tips, and nodeDepths
gives the depths of the internal nodes.
Michelle Kendall michelle.louise.kendall@gmail.com
nodeDepth
, nodeDepthFrac
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.