Dear Simon, I respectfully disagree with you, when you say that it is NOT a bug. Empty clusters can only happen if one provides a set of centers; if one enters something like k=4, it cannot happen, so it must be a bug. Which one is your case? >From the help:
"Except for the Lloyd-Forgy method, k clusters will always be returned if a number is specified. If an initial matrix of centres is supplied, it is possible that no point will be closest to one or more centres, which is currently an error for the Hartigan-Wong method" This having been said, I suspect that there is a bug in the current implementation of kmeans. I get the "empty cluster: try ..." answer even when I enter a number of clusters, but only with R 2.15. I never had it with R 2.14. Didn't try with R 3, yet. I posted this problem on the list twice, at no avail (unless I forgot to find the answer in the mailing list, of course). Kind regards, Luca > Hello all, > k-means algorithms can at times fail because one of the cluster become > emmpty. In this case, the kmeans R function returns: >"empty cluster: try a better set of initial centers" > This has been discussed several times on several R-lists, and is NOT a > bug, but can be annoying when using k-means in complex simulation where > this error brings everything to a stop. One can use try() or tryCatch() > to avoid this, but this is just a programming trick. -- ______________ Luca Nanetti, MSc, MRI University Medical Center Groningen Neuroimaging Center Groningen Groningen, The Netherlands Tel: +31 50 363 4733 [[alternative HTML version deleted]] ______________________________________________ R-help@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.