[R] fpc package - computing silhouette value returns error

William Dunlap wdunlap at tibco.com
Fri Aug 7 17:40:25 CEST 2015


help(distcritmulti) says that its 2nd argument is
   "clustering: vector of integers indicating the clustering"
and you supplied the output of hclust, which is not a
vector of group identifiers.  You can make a group
identifier vector from hc with cutree(hc, k=4), where k is
the number of groups.



Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Fri, Aug 7, 2015 at 7:40 AM, Ziqi Zhang <ziqi.zhang at sheffield.ac.uk>
wrote:

> Hi
> I am using R to do clustering and compute a number of cluster statistics.
> Below are my code. I do not understand why I get the error:
>
> "Error in summary(silhouette(clustering[ss[[i]]], dx)) : error in
> evaluating the argument 'object' in selecting a method for function
> 'summary': Error in round(x) : non-numeric argument to mathematical
> function"
>
> Any suggestsion highly appreciated!
> Code:
> --------------
> library(fpc)
> require(graphics)
> distance <- dist(USArrests, "euclidean")
> hc <-hclust(distance, "average")
> distcritmulti(USArrests, hc, criterion="asw", fun="dist",
> metric="euclidean")
> -------------
>
>
>
> --
> Ziqi Zhang
> Research Associate
> Department of Computer Science
> University of Sheffield
>
>
> ---
> This email has been checked for viruses by Avast antivirus software.
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list