Help with hclust() and plot()
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