order.dendrogram {stats}R Documentation

Get the ordering of the leaves in a dendrogram

Description

This function returns the order (index) for the leaves in a dendrogram. These indices can then be used to access the appropriate components of any additional data.

Usage

order.dendrogram(x)

Arguments

x A dendrogram (see as.dendrogram).

Details

The indices for the leaves in left to right order are retrieved.

Value

A vector with length equal to the number of leaves in the dendrogram is returned. Each element is the index into the original data (from which the dendrogram was computed)

Author(s)

R. Gentleman

See Also

reorder, dendrogram.

Examples

  set.seed(123)
  x <- rnorm(10)
  hc <- hclust(dist(x))
  hc$order
  dd <- as.dendrogram(hc)
  order.dendrogram(dd)

[Package Contents]