[R] kmeans error (bug?)
    Murad Nayal 
    mn216 at columbia.edu
       
    Mon Nov 10 06:52:35 CET 2003
    
    
  
Hello,
I have been getting the following intermittent error from kmeans:
>str(cavint.p.r)
 num [1:1967, 1:13] 0.691 0.123 0.388 0.268 0.485 ...
 - attr(*, "dimnames")=List of 2
  ..$ : chr [1:1967] "6" "49" "87" "102" ...
  ..$ : chr [1:13] "HYD" "NEG" "POS" "OXY" ...
> set.seed(34)
> kmeans(cavint.p.r,centers=34)
Error: empty cluster: try a better set of initial centers
the seed being equal to the number of centers in this case is just a
coincidence. I've encountered the same error with or without setting the
seed at different numbers of clusters.
there is nothing particularly unusual about cavint.p.r (no NAs, NULLs),
except maybe for the fact that the rows sum to 1.
> sum(is.na(cavint.p.r))
[1] 0
> sum(is.nan(cavint.p.r))
[1] 0
> 
I thought kmeans should select initial centers from the data if not
given explicitly! any idea what might be going wrong?
I am running R 1.7.0
many thanks
Murad
    
    
More information about the R-help
mailing list