This works, but it is not quite what I need: par(mar=rep(0,4))
while(1) { img1<-matrix(runif(2500),50,50) dev.hold(); image(img1,useRaster=TRUE); dev.flush() img2<-matrix(runif(2500),50,50) dev.hold(); image(img2,useRaster=TRUE); dev.flush() } I would like to do this: while(!kbhit()) { ... where kbhit() polls the keyboard, returning a non-zero integer if the keyboard buffer has something in it. The animation loop continues until a key is pressed. All the ways of getting user input I have seen (e.g. getGraphicsEvent) are not suitable because they would wait on each pass through the loop until the key is pressed and therefore no animation would be presented. Any ideas on how to present a continuous animation loop which is broken upon user input (keypress or mouse button press)? I am using Windows 7. Thanks very much for any help. Bill ______________________________________________ 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.