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)



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

spa

相关文章
相关标签/搜索