From ripley at stats.ox.ac.uk  Wed Sep 13 12:31:21 2006
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Wed, 13 Sep 2006 11:31:21 +0100 (BST)
Subject: [Rd] example(..., ask=getOption("example.ask"))
In-Reply-To: <59d7961d0609130251o536208f8j2c2dc7f12f738b26@mail.gmail.com>
References: <59d7961d0609130251o536208f8j2c2dc7f12f738b26@mail.gmail.com>
Message-ID: <Pine.LNX.4.64.0609131128480.19668@gannet.stats.ox.ac.uk>

And your point/question is?

par(ask = TRUE) applies to all devices, including png.  Try setting
options(par.ask.default = FALSE in your example?


On Wed, 13 Sep 2006, Henrik Bengtsson wrote:

> Hi,
> 
> I wish to return to the topic "[Rd] example(ask = .) - default ?"
> discussed in R-devel on May 1, 2006, because I think it is related to
> my problem.
> 
> In one of my Rd examples I generate multiple (20-30!) PNG files using
> png()/dev.off().  I noticed that I get a "Hit <Return> to see next
> plot:" for each png() call, when calling example() [interactively].
> 
> The code for example() has:
> 
>     if (ask == "default")
>         ask <- echo && dev.interactive(orNone = TRUE)
>     if (ask) {
>         if (.Device != "null device") {
>             opar <- par(ask = TRUE)
>             on.exit(par(opar))
>         }
>         op <- options(par.ask.default = TRUE)
>         on.exit(options(op), add = TRUE)
>     }
> 
> When calling example() interactively, either with ask=TRUE (explicitly
> or indirectly with getOption("example.ask") == "default"), option
> 'par.ask.default' is set to TRUE.  This seems to be the reason for the
> above.  Example:
> 
> > options(par.ask.default=TRUE)
> > png("foo.png"); plot(1); dev.off()
> Hit <Return> to see next plot:
> null device
>           1
> > options(par.ask.default=FALSE)
> > png("foo.png"); plot(1); dev.off()
> null device
>           1
> 
> Best
> 
> Henrik
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
> 

-- 
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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




[Rd] example(..., ask=getOption("example.ask"))
Prof Brian Ripley