Asha Jayanthi wrote:
Hi,
I have used the kmean fucntion in R to produce some results for my
analysis.
I like to know the specific underlying algorithm used for the
implementation of the function kmean in R. I tried looking for some
documents but could not find any.
I obtained the kmean result for k ranging from 2 to 10. When i did this
initally it worked perfectly. When i tried running again i get the error
Error: empty cluster: try a better set of initial centers
and i have not changed anything in the code. And i get this error only
for k = 2 and 10.
does anyone know why it worked well intially and failed now?
Asha
help for all R functions available on your system can be viewed using
?function_name - e.g. in your case ?kmeans displays the help for the
kmeans function.
Doing this gives:
...
centers: Either the number of clusters or a set of initial (distinct)
cluster centres. If a number, a random set of (distinct)
rows in 'x' is chosen as the initial centres.
So the randomness you are experiencing is related to the choice of centers.
Search the archives of this mailing list as this question was asked
recently - e.g. http://tolstoy.newcastle.edu.au/R/help/05/04/1692.html
Read all of ?kmeans as it has references for the algorithm used.
Gav
__
R-help@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