nnodes: Counts the number of nodes (Vertices) in a tree
Description
Counts the number of nodes in a tree (dendrogram, hclust,
phylo).
Usage
nnodes(x, ...)
## S3 method for class 'dendrogram':
nnodes(x, ...)
## S3 method for class 'hclust':
nnodes(x, ...)
## S3 method for class 'phylo':
nnodes(x, ...)
Arguments
x
tree object (dendrogram or hclust)
...
not used
Value
The number of leaves in the tree
Details
The idea for the name is from functions like ncol, and
nrow.
The phylo method is based on turning the phylo to hclust
and than to dendrogram. It may not work for complex phylo
trees.