Returns a cluster tree that is re-ordered by the average value of
x at
each merge.
USAGE:
clorder(tree, x)
REQUIRED ARGUMENTS:
tree
list with components named
merge,
height, and
order, typically a hierarchical clustering tree
produced by function
hclust.
x
numeric vector with one value for each individual involved
in the cluster tree.
Missing values (
NAs) are not allowed.
VALUE:
cluster tree structure with the
merge and
order components
permuted so that at any merge, the cluster with the smaller
average
x value is on the left.
This re-orders
tree so that the leaves
are approximately in order by the associated
x values.
SEE ALSO:
for the basic definition of the clustering method and structure.
EXAMPLES:
h <- hclust(dist(votes.repub))
ave.repub <- apply(votes.repub, 1, mean, na.rm=T)
# leaves ordered by average republican vote
h2 <- clorder(h, ave.repub)
plclust(h2, lab=state.abb) #cluster plot