Learn R Programming

dendextendRcpp (version 0.5.1)

labels.dendrogram: Find Labels from a dendrogram Object using Rcpp

Description

Extract the leaves labels from a dendrogram object.

Usage

## S3 method for class 'dendrogram':
labels(object, warn=FALSE, ...)

Arguments

Value

A vector of labels from the dendrogram leaves. This is often a character vector, but there are cases it might be integer.

source

R-devel-mailing list.

See Also

labels, dendrogram

Examples

Run this code
dend <- as.dendrogram(hclust(dist(USArrests)))

labels(dend)

require(microbenchmark)
microbenchmark(stats_labels.dendrogram(dend),
               dendextendRcpp::labels.dendrogram(dend),
               times = 100)
# about 30 times faster. It is faster the larger the tree is.

Run the code above in your browser using DataLab