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" <[EMAIL PROTECTED]>
To: <r-help@stat.math.ethz.ch>
Sent: Sunday, March 13, 2005 1:23 PM
Subject: [R] how to draw the data set processed by hclust?



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

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html




______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to