Reputation: 1163
I want to perform variable clustering using the varclus()
function from Hmisc
package.
However I do not know how to put clusters of variables into a table if I cut the dendrogram into 10 clusters of variable.
I used to use
groups <- cutree(hclust(d), k=10)
to cut dendrograms of individuals but it doesn't work for variables.
Upvotes: 3
Views: 1728
Reputation: 2640
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.
When you use varclus()
you're creating an object of class varclus
that contains a hclust
object - which can be referenced by using $hclust
.
Example:
x <- varclus(d)
x_hclust <- x$hclust ## retrieve hclust object
groups <- cutree(x_hclust, 10)
Upvotes: 0