Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/gwt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R中的树状图。如何按每个簇生成新表_R_Cluster Analysis_Dendrogram - Fatal编程技术网

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]]