[R] Until the key pressed: FOR-LOOP-Clustering

Liaw, Andy andy_liaw at merck.com
Wed May 10 19:41:58 CEST 2006


Not sure exactly what you're asking, but I'll take a stab at it:
Try adding par(ask=TRUE) before the for() loop.

Andy 

From: j.joshua thomas
> 
> Hi All,
> 
> These are the code that i used to plot the kmeans clustering.
> 
>  DataSetS01022<-rbind(matrix(rnorm(50),ncol=2),
> + matrix(rnorm(50),ncol=2))
> > colnames(DataSetS01022) <-c("timeslot","em")  (cl 
> ><-kmeans(DataSetS01022,2)) plot (DataSetS01022, col=cl$cluster)  
> >points(cl$centers, col = 1:2, pch = 8, cex=2)
> 
> Now, i would like to do *the same process for 5 times*, so 
> that i can view the clusters in data have been moving and the 
> center changes with various results.
> (Animation-like)
> 
> My main concern here, is how to put this in a *loop form* or 
> any other methods are available?
> 
> I tried with:* clarax$clusinfo I thought of doing it to 
> activate Device (1) & (2)*
> **
> *Really need anyones help!*
> **
> *JJ*
> *---*
> 
> 
> 
> --
> Lecturer J. Joshua Thomas
> KDU College Penang Campus
> Research Student,
> University Sains Malaysia
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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
> 
>




More information about the R-help mailing list