简体   繁体   English

使用clclust的层次聚类

[英]Hierarchical clustering using corclust

I am trying to create hierarchical cluster by using corclust function from klaR package in R. The function is trying to pass the values to the hclust function, but it is not accepting the parameters like mincor, method. 我正在尝试通过使用R中klaR包中的corclust函数来创建层次结构集群。该函数正在尝试将值传递给hclust函数,但它不接受mincor,method之类的参数。

code

plot(corclust(iris[,-5],iris[,5],mincor=0.5)) 情节(corclust(iris [,-5],iris [,5],mincor = 0.5))

While running the above line am getting the following error. 在运行上述行时,出现以下错误。

Error 错误

Error in corclust(iris[, -5], iris[, 5], mincor = 0.5) : unused argument (mincor = 0.5) 晕针错误(iris [,-5],iris [,5],mincor = 0.5):未使用的参数(mincor = 0.5)

Please let me know how to resolve this error. 请让我知道如何解决此错误。

The error comes up because you are specifying "mincor" as an argument for the corclust function, which does not use it. 出现错误是因为您将“ mincor”指定为corclust函数的参数,该函数不使用它。 Instead just try: 而是尝试:

plot(corclust(iris[,-5]))

That should give you the cluster dendogram. 那应该给您簇状树状图。 However, the iris dataset after removing the species column contains no factor variables so you might want to try it out with another dataset. 但是,除去种类列后的虹膜数据集不包含任何因子变量,因此您可能想尝试另一个数据集。

Hope that helps! 希望有帮助!

Your code has several issues: 您的代码有几个问题:

  1. The mincor argument belongs to the plot function call, not corclust . mincor参数属于plot函数调用,而不是corclust
  2. You provide a data.frame and a vector to corclust when it only takes a data.frame (see ?corclust ). 当仅需要corclust时,就可以提供data.framevector来使之data.frame (请参阅?corclust )。
  3. I assume you don't need the 5th column for corclust because it's categorial. 我认为你不需要为第5列corclust因为它的范畴。

So that gives you: 因此,您可以:

plot(corclust(iris[,-5]), mincor=0.5)

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

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