[R] wait for user input

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Feb 20 10:20:09 CET 2001

On Tue, 20 Feb 2001, Bill Simpson wrote:

> I want to display a series of plots:
> display plot 1
> wait for user input (keypress or mouse click)
> display plot 2
> etc
> How to do it? Thanks for any help.
> (I have been using locator().)

par(ask=TRUE)  seems what you need.
You can also use readline() to get text input from the user.

In general you can't wait on just a keypress (except Return: the input is
line-buffered) or on a mouse click (R is not handling GUI events) on
Linux, which I seem to recall is your platform.

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list