I'm clustering rather large data sets and would like to cut the dendrograms to get a better view of specific components. I calculate the dissimilarity matrix using daisy() because I have a mixture of variable types: factors, ordered factors and numerical variables. If I want one dendrogram, I use agnes() for the agglomerative nesting and pltree() to draw the dendrogram. That way, I get the row names as labels, but I can't cut the tree. Alternatively, I use hclust() on the dissimilarity matrix from daisy(). This allows me to cut the dendrogram with cutree(), but I loose the labels, so that isn't much use. I can change the output from hclust() to class dendrogram with as.dendrogram(). This has a rather neat way of cutting the dendrogram with cut.dendrogram(), which allows you to show specific lower sections of the dendrogram with plot.dendrogram(object$lower[[1]]). Again, I loose the labels. Does anyone know how to keep the row names as labels when starting with daisy() and ending with plot.dendrogram()? A couple of months ago, I had a look at the code for as.hclust() and managed to change it so that I could keep the labels, but now I don't remember how I got to see the code. When I type as.hclust, I get "function(x,...) UseMethod("as.hclust")". Also, does anyone know how to get a horizontal dendrogram so that the labels are readable? Ideally with the labels to the right?? Any help would be greatly appreciated. Best wishes, Mikkel -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Mikkel-- I presume you modified plot.hclust() when last you hacked the labels-- I've done similar modifications in the past. --Mike C. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Michael A. Camann Voice: 707-826-3676 Associate Professor of Zoology Fax: 707-826-3201 Institute for Forest Canopy Research Email: mac24 at axe.humboldt.edu Department of Biology ifcr at axe.humboldt.edu Humboldt State University Arcata, CA 95521 URL:http://www.humboldt.edu/~mac24/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> I'm clustering rather large data sets and would like to cut thedendrograms> to get a better view of specific components. I calculate thedissimilarity> matrix using daisy() because I have a mixture of variable types:factors,> ordered factors and numerical variables. If I want one dendrogram, Iuse> agnes() for the agglomerative nesting and pltree() to draw thedendrogram.> That way, I get the row names as labels, but I can't cut the tree. > > Alternatively, I use hclust() on the dissimilarity matrix from daisy().> This allows me to cut the dendrogram with cutree(), but I loose thelabels,> so that isn't much use. I can change the output from hclust() toclass> dendrogram with as.dendrogram(). This has a rather neat way ofcutting the> dendrogram with cut.dendrogram(), which allows you to show specificlower> sections of the dendrogram with plot.dendrogram(object$lower[[1]]).Again, I> loose the labels. > > Does anyone know how to keep the row names as labels when startingwith> daisy() and ending with plot.dendrogram()? A couple of months ago, Ihad a> look at the code for as.hclust() and managed to change it so that Icould> keep the labels, but now I don't remember how I got to see the code.When I> type as.hclust, I get "function(x,...) UseMethod("as.hclust")". > > Also, does anyone know how to get a horizontal dendrogram so that thelabels> are readable? Ideally with the labels to the right?? > Any help would be greatly appreciated. > > Best wishes, > MikkelIf your data are "spatial", that is, they can be identified through two dimensional coordinates, you could try the mapping techniques in package maptree. Groups of observations (rows) in higher level clusters can be given the same symbol/color to show cluster patterns. But the labels of individual observations are not preserved through this process either. There is a new function in that package, kgs(), that calculates, using a penalty function, an optimal size to which to prune a dendrogram. -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._