[R] How do I change which R Graphics Device is active?

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Wed Jul 1 16:45:24 CEST 2009


On Wed, Jul 1, 2009 at 3:30 PM, Don MacQueen<macq at llnl.gov> wrote:
> My version would be
>
>  newDev <-  function() { dev.new(); invisible( dev.cur() ) }
>
> I agree with Hadley that return() is redundant in this instance. Using
> invisible() suppresses automatic printing of the returned value when it is
> not being assigned to a variable, thus making it more like dev.new().

 Hmmm. I really like using explicit return calls in my functions. It
seems, to me, to make it clear that I intend to return a value and
that value is going to be useful. How can others tell (without looking
at the ample documentation, of course) that you intend your function
to have a meaningful return value and it's not just "falling through"?

As The Zen of Python puts it:

 Explicit is better than implicit.
 Readability counts.

but you know, hey, whatever you want to do :)

Barry




More information about the R-help mailing list