简体   繁体   English

如何用R中的VARCLUS剪切树形图(包装Hmisc)

[英]how to cut the dendrogram with VARCLUS in R (package Hmisc)

I want to perform variable clustering using the varclus() function from Hmisc package. 我想使用Hmisc包中的varclus()函数执行变量聚类。 However I do not know how to put clusters of variables into a table if I cut the dendrogram into 10 clusters of variable. 但是,如果我将树形图切割成10个变量簇,我不知道如何将变量簇放入表中。

I used to use 我以前用过

groups <- cutree(hclust(d), k=10)

to cut dendrograms of individuals but it doesn't work for variables. 削减个体的树状图,但它不适用于变量。

Expanding on @Anatoliy's comment, you indeed use the same cutree() function as before because the clustering done in varclus() is actually done by the hclust() function. 扩展@ Anatoliy的注释,你确实使用了与之前相同的cutree()函数,因为在varclus()中完成的聚类实际上是由hclust()函数完成的。

When you use varclus() you're creating an object of class varclus that contains a hclust object - which can be referenced by using $hclust . 当您使用varclus()你正在创建该类的对象varclus包含hclust对象-这可以通过使用引用$hclust

Example: 例:

x <- varclus(d)
x_hclust <- x$hclust  ## retrieve hclust object

groups <- cutree(x_hclust, 10)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM