Skip to content

how to draw the data set processed by hclust?

2 messages · XP Sun, Ales Ziberna

#
hi, all

   i hava a dataset formated as follow:

	x1 y1 z1
	x2 y2 z2
	x3 y3 z3
	...	

	how to cluster it with hclust?
	and the draw the data with color of cluster?

	thank you in advance!

best!
xpsun
1 day later
#
type
 ?hclust
for how to use hclut, for example
 hc <- hclust(dist(USArrests), "ave")
Notice that you have to first compute the distance matrix with function 
"dist" or simmilar.

to get groups see
?cutree
for expamle for three grouops use k=3
groups<-cutree(hc,k=3)
and then plot using
plot(USArrests,col=groups)

I hope this help! In the future, PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html and follow the instructions 
(read help pages)!



----- Original Message ----- 
From: "XP Sun" <xpsun at ict.ac.cn>
To: <r-help at stat.math.ethz.ch>
Sent: Sunday, March 13, 2005 1:23 PM
Subject: [R] how to draw the data set processed by hclust?