R语言学习之聚类

n<-seq(1,50,by=4)
2(x<-¡USArrests[n,])#print()
hc1<-hclust(dist(x),method="complete")
4hc2<-hclust(dist(scale(x)),method="complete")
hc3<-hclust(dist(x),method="ave")
layout(matrix(c(1,1,2,3),nrow=2,byrow=T))
plot(hc1);plot(hc2);plot(hc3)



R语言学习之聚类

library(cluster)
clusplot(x,pam(x,2)$clustering)

R语言学习之聚类

你可能感兴趣的:(R语言学习之聚类)