Learn R Programming

TreeTools (version 1.12.0)

NDescendants: Count descendants for each node in a tree

Description

NDescendants() counts the number of nodes (including leaves) directly descended from each node in a tree.

Usage

NDescendants(tree)

Value

NDescendants() returns an integer listing the number of direct descendants (leaves or internal nodes) for each node in a tree.

Arguments

tree

A tree of class phylo.

See Also

Other tree navigation: AncestorEdge(), CladeSizes(), DescendantEdges(), EdgeAncestry(), EdgeDistances(), ListAncestors(), MRCA(), MatchEdges(), NodeDepth(), NodeNumbers(), NodeOrder(), RootNode()

Examples

Run this code
tree <- CollapseNode(BalancedTree(8), 12:15)
NDescendants(tree)
plot(tree)
nodelabels(NDescendants(tree))

Run the code above in your browser using DataLab