R中的树状图。如何按每个簇生成新表
R中的树状图。如何按每个簇生成新表,r,cluster-analysis,dendrogram,R,Cluster Analysis,Dendrogram,库(mlbench) 图书馆(统计) 大学试试这个: # your matrix dimensions have to match with the clustering results # remove any columns from na.college, as you did for clustering mat <- na.college[,-c(1:3)] # select the data based on the clustering results cluster_2
库(mlbench)
图书馆(统计)
大学试试这个:
# your matrix dimensions have to match with the clustering results
# remove any columns from na.college, as you did for clustering
mat <- na.college[,-c(1:3)]
# select the data based on the clustering results
cluster_2 <- mat[which(groups==2),]
谢谢,但我还有一个问题。谢谢安德烈提出来!
# your matrix dimensions have to match with the clustering results
# remove any columns from na.college, as you did for clustering
mat <- na.college[,-c(1:3)]
# select the data based on the clustering results
cluster_2 <- mat[which(groups==2),]
# each list entry will correspond to the cluster number
clust_list <- lapply(sort(unique(groups)), function(x) mat[which(groups==x),])
# to retrieve i.e cluster 2:
cluster_2 <- clust_list[[2]]