[Rd] example() and "ask"
Gavin Simpson
gavin.simpson at ucl.ac.uk
Wed Jun 18 14:28:20 CEST 2008
Dear list,
Is it intentional that example() opens a new device and leaves it in a
mode where it asks (prompts) the user to Press return to see the next
plot for *all* subsequent plots on that device.
For example; with an already opened device, example() works as I would
expect:
> par("ask")
[1] FALSE
> example(lm)
.... OUTPUT CLIPPED ....
lm> plot(lm.D9, las = 1) # Residuals, Fitted, ...
Hit <Return> to see next plot:
lm> par(opar)
lm> ## model frame :
lm> stopifnot(identical(lm(weight ~ group, method = "model.frame"),
lm+ model.frame(lm.D9)))
> plot(1:10)
>
So with an already opened device, plots /within/ example prompt the user
(by default) but at the end of the example, we return to default and we
are not prompted to display subsequent plots on that device (par("ask)
== FALSE)
However, if example opens a device (i.e. example is the first plotting
function called in a session), then the device remains in "prompt" mode:
> # continue example from above, so close the device
> dev.off()
null device
1
> example(lm) # will open device when required
.... output suppressed ....
lm> plot(lm.D9, las = 1) # Residuals, Fitted, ...
Hit <Return> to see next plot:
lm> par(opar)
lm> ## model frame :
lm> stopifnot(identical(lm(weight ~ group, method = "model.frame"),
lm+ model.frame(lm.D9)))
> par("ask")
[1] TRUE
> plot(1:10)
Hit <Return> to see next plot:
Device remains in "prompt" mode.
I would have expected example() to clean up and return par("ask") to
what it was before example() was called in the case where it opens it's
own device, just as it does if called with an already open and active
device.
If this is intentional, it doesn't strike me as being intuitive or user
friendly. Is there scope and a will to change this behaviour?
This is with R 2.7.1RC and R 2.8.0 to be:
> version
_
platform x86_64-unknown-linux-gnu
arch x86_64
os linux-gnu
system x86_64, linux-gnu
status RC
major 2
minor 7.1
year 2008
month 06
day 16
svn rev 45948
language R
version.string R version 2.7.1 RC (2008-06-16 r45948)
> version
_
platform x86_64-unknown-linux-gnu
arch x86_64
os linux-gnu
system x86_64, linux-gnu
status Under development (unstable)
major 2
minor 8.0
year 2008
month 06
day 18
svn rev 45948
language R
version.string R version 2.8.0 Under development (unstable) (2008-06-18 r45948)
Many thanks,
G
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Dr. Gavin Simpson [t] +44 (0)20 7679 0522
ECRC, UCL Geography, [f] +44 (0)20 7679 0565
Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/
UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
More information about the R-devel
mailing list