[R] how to find the number of iterations kmeans used to converge?

David Winsemius dwinsemius at comcast.net
Fri Jan 13 14:16:11 CET 2012


On Jan 13, 2012, at 5:53 AM, Rui Esteves wrote:

> Dear all,
>
> I need to know in which number of iterations the kmeans converge each
> time I run it.
> Any idea how to do it?
>

Look at the help page (to see that it is not part of the returned  
object) and then look at the code (to see that the object returned  
from the .C() call is immediately checked to see if the number of  
iterations exceeded the maximum set by the user. Search for this code:

if (Z$iter > iter.max)

Then you should be able to see your way forward. You can either create  
a modified return object or you can insert a line that prints that  
value.

-- 
David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list