[R] changing the ordering of leaves in a dendrogram
White.Denis@epamail.epa.gov
White.Denis at epamail.epa.gov
Mon Jan 14 01:25:39 CET 2002
> I'd like to change the way plot.hclust displays an hclust object.
Here's
> a description of how it's done now, from the R documentation of
hclust:
>
> In hierarchical cluster displays, a decision is needed at each
merge
> to specify which subtree should go on the left and which on the
right.
> Since, for n observations there are n-1 merges, there are
2^{(n-1)}
> possible orderings for the leaves in a cluster tree, or
dendrogram.
> The algorithm used in hclust is to order the subtree so that the
> tighter cluster is on the left (the last, i.e. most recent, merge
> of the left subtree is at a lower value than the last merge of
the
> right subtree). Single observations are the tightest clusters
possible,
> and merges involving two observations place them in order by
their
> observation sequence number.
>
> I have a factor vector (if that's the right term) for the
observations, and
> I'd like to order the display of the leaves so that leaves of the same
> level are grouped together as much as possible. Even something as
simple
> as putting the higher average code on the left would help.
>
> I've spent some time looking at the code in rpart, but I'm having a
hard
> time figuring out what I need to modify. Or maybe someone's already
done
> something similar? Any help much appreciated!
>
> David Marimont
> NXP Data Analysis, Inc.
> http://www.nxpdata.com
You could look at function group.clust in contributed package maptree
for possible ideas.
Denis White
US EPA, 200 SW 35th St, Corvallis, Oregon, 97333 USA
voice: 541.754.4476, email: white.denis at epa.gov
web: www.epa.gov/wed/pages/staff/white/
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list