1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/nleaves.R
\name{nnodes}
\alias{nnodes}
\alias{nnodes.default}
\alias{nnodes.dendrogram}
\alias{nnodes.hclust}
\alias{nnodes.phylo}
\title{Counts the number of nodes (Vertices) in a tree}
\usage{
nnodes(x, ...)
\method{nnodes}{default}(x, ...)
\method{nnodes}{dendrogram}(x, ...)
\method{nnodes}{hclust}(x, ...)
\method{nnodes}{phylo}(x, ...)
}
\arguments{
\item{x}{tree object (dendrogram or hclust)}
\item{...}{not used}
}
\value{
The number of leaves in the tree
}
\description{
Counts the number of nodes in a tree (dendrogram, hclust, phylo).
}
\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.
}
\examples{
hc <- hclust(dist(USArrests[1:5, ]), "ave")
dend <- as.dendrogram(hc)
nnodes(dend) # 9
nnodes(hc) # 9
}
\seealso{
\link{nrow}, \link{count_terminal_nodes}, \link{nleaves}
}
|