[R] example() leaves console prompting to press Enter for new graphs

David Winsemius dwinsemius at comcast.net
Mon Jan 11 16:09:38 CET 2010


On Jan 11, 2010, at 9:28 AM, Michael Friendly wrote:

> Env: Win XP, R 2.9.2]
>
> It's a minor annoyance, but I find that after I run example(), the  
> console state of prompting to press Enter for
> each new graph remains as it is under example.  It's more annoying  
> that it seems difficult to turn this behavior
> off!

I have had the same annoyance when I interrupted a sequence of  
examples with ctrl-C and this prevented the restoration of the initial  
state. You could try:

options(device.ask.default = FALSE)      # and / or

grDevices::devAskNewPage(ask=FALSE)

Changing the first one on my machine did nothing, but the second one  
was effective,

-- 
David.

>
> In a fresh session:
> >  getOption("example.ask")
> [1] "default"
>
> Run an example:
> > example(plot)
> plot> require(stats)
>
> plot> plot(cars)
> Waiting to confirm page change...
> ...
>
> > getOption("example.ask")
> [1] "default"
>
> # do another plot:
> > plot(sin, -pi, 2*pi)
> Waiting to confirm page change...
> >
>
> # reset option to FALSE
> > options("example.ask"=FALSE)
> > plot(sin, -pi, 2*pi)
> Waiting to confirm page change...
>
> # try resetting devAskNewPage
> > devAskNewPage(ask = NULL)
> [1] TRUE
> > plot(sin, -pi, 2*pi)
> Waiting to confirm page change...
> >
>
> There does seem to be code in example to reset this state on exit,  
> and I'm baffled why it doesn't actually
> do it
>
>  ...
>   if (ask == "default")
>       ask <- echo && grDevices::dev.interactive(orNone = TRUE)
>   if (ask) {
>       if (.Device != "null device") {
>           oldask <- grDevices::devAskNewPage(ask = TRUE)
>           if (!oldask)
>               on.exit(grDevices::devAskNewPage(oldask), add = TRUE)
>       }
>       op <- options(device.ask.default = TRUE)
>       on.exit(options(op), add = TRUE)
>   }
>  ...
>
> So, how can I restore the previous state of plotting w/out prompting?
>
>
> -- 
> Michael Friendly     Email: friendly at yorku.ca Professor, Psychology  
> Dept.
> York University      Voice: 416 736-5115 x66249 Fax: 416 736-5814
> 4700 Keele Street    http://www.math.yorku.ca/SCS/friendly.html
> Toronto, ONT  M3J 1P3 CANADA
>
> ______________________________________________
> R-help at 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.

David Winsemius, MD
Heritage Laboratories
West Hartford, CT



More information about the R-help mailing list