[R] Error in pruning hclust object using maptree package

Uwe Ligges ligges at statistik.tu-dortmund.de
Tue Mar 16 18:06:24 CET 2010



On 15.03.2010 16:37, Keith wrote:
> Dear R users,
>
> Due to too many children in my clustering result, I would like to prune
> the tree-like hclust object into a certain groups. However, an error:
>
>  > clip.clust: no data provided for hclust object
>
> always shows up.
>
> Firstly, I tried the example in the maptree package, and it worked well.
> Then, I tried to used the example in stats package to generate a hclust
> object and tried the clip.clust method again, and the error still
> occurred. Here is the example:
>
>  > hc <- hclust(dist(USArrests), "ave")
>  > pr <- clip.clust(hc, k=4)
> Error in clip.clust(hc, k = 4) :
> clip.clust: no data provided for hclust object

Have you read ?clip.clust ??
It says for argument "data":
  data 	clustered dataset for hclust application.

whic means you need to provide "data" as the error message suggests as well.

  pr <- clip.clust(hc, k=4, data=USArrests)
  pr$membership

works for me.

Uwe Ligges







> Does anyone have the idea? My environment is
> R version 2.10.1 (2009-12-14)
> x86_64-pc-linux-gnu
> [1] maptree_1.4-6
>
> Best regards,
> Keith
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list