[R] R 2.7.0: pdf() > pdf.options versus formals

Hans-Joerg Bibiko bibiko at eva.mpg.de
Mon May 26 10:59:55 CEST 2008


Hi,

I have a tiny question about the graphics change in R 2.7.0.

If I write a script à la:

options(device="pdf")
formals(pdf)[c("file","onefile","width","height")] <- list("~/Rplot 
%03d.pdf", FALSE, 8, 8)
plot(3)
plot(4)

both plots will be written into ONE pdf file. (not two as expected)
This worked fine under 2.6.x

In R 2.7.0 I have to write:

options(device="pdf")
formals(pdf)[c("file","onefile","width","height")] <- list("~/Rplot 
%03d.pdf", FALSE, 8, 8)
pdf.options(onefile=F)
plot(3)
plot(4)

In the NEWS doc for R 2.7.0 is written:
pdf() now takes defaults from the new function pdf.options() ...

Fine. But is there no way to use formals in that context (or more  
precisely to preset 'onefile' because other arguments are taken from  
formals)?

I have several scripts written for R 2.6 and that would mean that I  
have to rewrite all of them.

R version 2.7.0 (2008-04-22)
powerpc-apple-darwin8.10.1

locale:
en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base


Many thanks in advance,

--Hans


More information about the R-help mailing list