I often use something like old.par <- par(set someting) on.exit(par(old.par)) but in R 1.7.0. I now get warnings:> old.par <- par() > par(old.par)Warning messages: 1: parameter "cin" can't be set in: par(args) 2: parameter "cra" can't be set in: par(args) 3: parameter "csi" can't be set in: par(args) 4: parameter "cxy" can't be set in: par(args) 5: parameter "din" can't be set in: par(args) 6: gamma cannot be modified on this device in: par(args) Is this a mistake or a new feature? If it is a new feature, is there a simple way to avoid the warnings? Thanks, Paul Gilbert
>-----Original Message----- >From: r-devel-bounces@stat.math.ethz.ch >[mailto:r-devel-bounces@stat.math.ethz.ch] On Behalf Of Paul Gilbert >Sent: Monday, May 12, 2003 3:33 PM >To: R-devel@stat.math.ethz.ch >Subject: [Rd] on.exit(par(old.par)) warnings > > >I often use something like > > old.par <- par(set someting) > on.exit(par(old.par)) > >but in R 1.7.0. I now get warnings: > >> old.par <- par() >> par(old.par) >Warning messages: >1: parameter "cin" can't be set in: par(args) >2: parameter "cra" can't be set in: par(args) >3: parameter "csi" can't be set in: par(args) >4: parameter "cxy" can't be set in: par(args) >5: parameter "din" can't be set in: par(args) >6: gamma cannot be modified on this device in: par(args) > >Is this a mistake or a new feature? If it is a new feature, is >there a simple >way to avoid the warnings? > >Thanks, >Paul GilbertPaul, You should be using: old.par <- par(no.readonly=TRUE) on.exit(par(old.par)) Without the 'no.readonly=TRUE' in the first call, you will store and then try to set non-user adjustable (read only) parameters, hence the warning. HTH, Marc Schwartz
>From the help page's examples section## Alternatively, op <- par(no.readonly = TRUE) # the whole list of settable par's. ## do lots of plotting and par(.) calls, then reset: par(op) and no, it's not new and it is not a mistake (in R). On Mon, 12 May 2003, Paul Gilbert wrote:> I often use something like > > old.par <- par(set someting) > on.exit(par(old.par)) > > but in R 1.7.0. I now get warnings:Note: that's not the same thing as the previous usage.> > old.par <- par() > > par(old.par) > Warning messages: > 1: parameter "cin" can't be set in: par(args) > 2: parameter "cra" can't be set in: par(args) > 3: parameter "csi" can't be set in: par(args) > 4: parameter "cxy" can't be set in: par(args) > 5: parameter "din" can't be set in: par(args) > 6: gamma cannot be modified on this device in: par(args) > > Is this a mistake or a new feature? If it is a new feature, is there a simple > way to avoid the warnings?-- Brian D. Ripley, ripley@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