Skip to content
Back to formatted view

Raw Message

Message-ID: <871vs8bcqz.fsf@lse.ac.uk>
Date: 2009-04-04T16:32:52Z
From: Jim Ottaway
Subject: temporarily modify par values?

>>>>> Gabor Grothendieck <ggrothendieck at gmail.com> writes:

> Here is a minor variation:
> par <- function( ... ) structure( graphics::par( ... ), class = "par" )
> with.par <- function( data, expr, ... ) {
>    on.exit(par(old.par, no.readonly = TRUE))
>    old.par <- data
>    invisible(expr)
> }

> which returns expr invisibly so that this works:

> bp <- with(par(mar = c(4, 1, 1, 1)), boxplot(1:10))

Thank you very much, that looks like a better way of cleaning up with an
error too than my attempt.


Yours sincerely,
-- 
Jim Ottaway