[R] about rect.hclust

Gregory Jefferis jefferis at gmail.com
Sat Apr 26 07:41:19 CEST 2014


On 26 Apr 2014, at 02:35, chris Jhon <cjhon217 at gmail.com> wrote:

> The question is how to plot the cluster number on the dendrogram plot?

Besides Peter Langfelder’s suggestion, you may also want to take a look at CRAN packages dendroextras or dendextend

For example using the dendro	extras

# set up your data
##
y=read.table(text=" V1 V2 V3 V4
A  1  2  3  4
B  5  6  7  8
C  9 10 11 12
D 13 14 15 16
E 17 18 19 20",header=T)
clu<-hclust(dist(y),method="complete")
plot(clu)

# plot dendrogram coloured by cluster:
##
library(dendroextras)
cluc=colour_clusters(clu, k=3, labels=TRUE)
plot(cluc)

Best wishes,

Greg Jefferis.




More information about the R-help mailing list