[R] error in kmeans

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Apr 1 18:38:50 CEST 2005


On Fri, 1 Apr 2005, Asha Jayanthi wrote:

> I am trying to generate kmean of 10 clusters for a 165 x 165 matrix.
>
> i do not see any errors known to me. But I get this error on running the 
> script
>
> Error: empty cluster: try a better set of initial centers
>
> the commands are
>
> M <-matrix(scan("R_mutual",n = 165 * 165),165,165,byrow = T)
>
> cl <- kmeans(M,centers=10,20)
> len = dim(M)[1]
> ....
> ....
>
> I ran the same script last night and it was working prefectly. I have not 
> made any changes at all !!!And this is very strange. This evening when I ran 
> the same script i am getting this error. My matrix file is also untouched.

It uses a random choice.  See the help page, which says so explicitly.

>
> Can any one let me know how to go about this. I must generate 10-mean 
> clusters
> Is there anyother way of doing it ? and how to avoid such error in future?
>
> Asha
>
>
> http://www.cross-tab.com/surveys/run/test.asp?sid=2026&respid=1 Help us help 
> you better!
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list