[R] non-mouse-sensitive pause between showing plots

Richard.Cotton at hsl.gov.uk Richard.Cotton at hsl.gov.uk
Thu Oct 2 16:22:41 CEST 2008

> I am using R version 2.7.2 on Windows. I would like to create a script
> that draws many plots and pauses before drawing a new plot, so that I
> could copy each plot consecutively to clipboard ("Copy as metafile" from
> context menu) or save it to a file ("Save as metafile" from context
> menu).
> I know that par(ask=TRUE) or devAskNewPage(TRUE) can be used to achieve
> something like that, but unfortunately they also accept mouse click as a
> confirmation by the user, so that I cannot use the right mouse button to
> open the context menu.
> Using readline() is also not a good idea because when I execute the
> script with Ctrl-R, readline() just eats the subsequent line in the
> script instead of waiting until the user presses <Enter> (See e.g. post
> http://tolstoy.newcastle.edu.au/R/help/04/11/8089.html which also says
> that pause() in package DAAG has similar behaviour because it uses uses
> readline()).
> I would be satisfied if devAskNewPage had an option that asking new page
> would accept keyboard input only, e.g. devAskNewPage("keyboardOnly").

You can use Sys.sleep to pause, but you may be better off writing the 
plots to file directly, rather than having to interact with them, e.g.



Mathematical Sciences Unit


This message contains privileged and confidential inform...{{dropped:20}}

More information about the R-help mailing list