reorder.dendrogram
Reorder a Dendrogram

Description

Reorder branches of a dendrogram.

Usage

## S3 method for class 'dendrogram':
reorder(x, wts, agglo.FUN = sum, ...) 

Arguments

x a "dendrogram" object.
wts a numeric vector, where each element specifies a weighting value for the corresponding value in x.
agglo.FUN a character string, indicates the function name used for weights agglomeration
... Any additional arguments are ignored.

Details

reorder.dendrogram is a generic method of class "dendrogram".
Value
Returns a dendrogram equivalent to the input dendrogram but with the branches at each interior node permuted so the branch values implied by wts are in increasing order. Every node will have an attribute named "value" attached to it: a leaf node's value will be wts[as.integer(node)] and an interior node's value will be agglo.FUN applied to the vector of values of its branches.
See Also
as.dendrogram, reorder.
Examples
dat <- data.frame(row.names=letters[1:7], SinSqrt=sin(sqrt(1:7)), Cos=cos(1:7), wts=11:17)
dendr <- as.dendrogram(hclust(dist(dat)))
str(dendr)
str(reorder(dendr, wts=dat$wts)) # default agglomeration is to sum weights
str(reorder(dendr, wts=dat$wts, agglo.FUN=max))
Package stats version 6.0.0-69
Package Index