nodeDepth: Node depth

View source: R/nodeDepth.R

nodeDepthR Documentation

Node depth

Description

Determine the depth of a particular node in a tree, defined as the number of edges between it and the root. (So the root has depth zero, its children have depth one, etc.)

Usage

nodeDepth(tree, node)

Arguments

tree

a tree of class phylo or phylo4. The tree should be binary and rooted; if not it will be coerced into a binary rooted tree using multi2di, if possible.

node

a number corresponding to a node in the tree.

Value

An integer corresponding to the depth of the given node.

Author(s)

Michelle Kendall michelle.louise.kendall@gmail.com

Examples

## Find the depth of node 34 in a random tree with 20 tips:
tree <- rtree(20)
plot(tree)
nodelabels()
nodeDepth(tree,34)
 


MichelleKendall/phyloTop documentation built on Feb. 1, 2023, 8:07 a.m.