[R] function 'silhouette' in package 'cluster'

Laurent Gautier laurent at cbs.dtu.dk
Thu Feb 6 09:40:03 CET 2003


Dear all,

I am trying (without much success) to use the fuction 'silhouette'.
Would anyone encountered that before (or would know where I am wrong ?)

Please find below the R ouput. Thanks in advance,


L.


> s <- silhouette(ct, as.dist(metric))
Error in "[<-"(*tmp*, iC, "sil_width", value = s.i) : 
	number of items to replace is not a multiple of replacement length
In addition: Warning messages: 
1: longer object length
	is not a multiple of shorter object length in: b.i - a.i 
2: number of rows of result
	is not a multiple of vector length (arg 2) in: cbind(mmm, as.vector(each)) 
> 
> traceback()
2: silhouette.default(ct, as.dist(metric))
1: silhouette(ct, as.dist(metric))

> str(ct)
 Named int [1:2381] 1 1 1 1 1 2 2 2 1 1 ...
 - attr(*, "names")= chr [1:2381] "5153" "22" "5185" "356" ...
> str(metric)
 num [1:2381, 1:2381] 0.000 1.438 1.172 0.751 0.432 ...
 - attr(*, "dimnames")=List of 2
  ..$ : chr [1:2381] "5153" "22" "5185" "356" ...
  ..$ : chr [1:2381] "5153" "22" "5185" "356" ...
>




More information about the R-help mailing list