Re: [R] Help with hclust() and plot()

About this list Date view Thread view Subject view Author view Attachment view

From: Sundar Dorai-Raj (sundar.dorai-raj@pdf.com)
Date: Fri 21 May 2004 - 04:03:49 EST


Message-id: <40ACF305.3060408@pdf.com>


michael watson (IAH-C) wrote:

> Hi
>
> Thanks for that! BUT if I use as.dendrogram, I can't use my labels
> anymore!
>
>
>>plot(hclust(...etc), labels=p[,1])
>
>
> Works fine. But:
>
>
>>plot(as.dendrogram(hclust(...etc)), labels=p[,1])
>
>
> Gives me errors:
>
> Error in axis(side, at, labels, tick, line, pos, outer, font, vfont,
> lty, :
> location and label lengths differ, 6 != 24
>
> I have 24 labels. I have no idea where it gets 6 from!
>
> My 'dendrogram' has '2 branches and 24 members total'.
>
> SOOO, how do I get my dendrogram horizontal, or vertical for that
> matter, with useful labels instead of 1,2,3,4,5,etc
>
> Thanks in advance for your help!
>
> Mick
>

Mick,
   Change the labels in hclust first:

data(USArrests)
hc <- hclust(dist(USArrests), "ave")
hc$labels <- 1:50
dend1 <- as.dendrogram(hc)
plot(dend1, horiz = TRUE)

--sundar

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Mon 31 May 2004 - 23:05:11 EST