[R] hclust interrogation & use of $merge for dendrogram annotation?
Ben Davies
ben.davies at anu.edu.au
Fri Aug 1 09:48:25 CEST 2008
Hi all,
I've been doing some investigation to see if it is possible to implement an hclust/dendrogram related requirement that I've been given. So far ?hclust and a lot of googling haven't provided the information I'm looking for (I've been using R sporadically for a year).
The requirement I have is to:
On a dendrogram plot, draw points at various merge locations, based on some other data. For instance, for an initial 15 cluster dend, assume I need to mark the 1st,2nd and 7th merge by drawing points on the plot. This needs to be done within an R script, though if some FORTRAN or C code needs to be modified, that is fine.
Where I'm stuck is:
1) making sense of the full $merge in hclust
2) programatically calculating an X-coordinate for plotting the marker points.
For 1) The first couple of merges in make sense as they correspond to known clusters. But after several merges, the values in $merge do not seem to correspond to anything. eg. After a merge, what/how is the 'new' cluster referred to? This results is not knowing what needs to be done to programatically locate where on the plot the merge at height 'h' is.
At this stage I'm assuming part of this lies in the 2 external FORTRAN functions that hclust calls. Any assistance on how to determine the merge location on the plot would be great!
Thanks,
Ben
More information about the R-help
mailing list