Subsets of a dataset as separate dendrograms, but in the same plot
问题 I know I can plot a dendrogram as follows library(cluster) d <- mtcars d[,8:11] <- lapply(d[,8:11], as.factor) gdist <- daisy(d, metric = c("gower"), stand = FALSE) dendro <- hclust(gdist, method = "average") plot(as.dendrogram(dendro)) However I have some groups identified (eg. by an iterative classification method), given as the last column in d G <- c(1,2,3,3,4,4,5,5,5,5,1,2,1,1,2,4,1,3,4,5,1,7,4,3,3,2,1,1,1,3,5,6) d$Group <- G head(d) mpg cyl disp hp drat wt qsec vs am gear carb Group