Re: [R] if/else for plot/lines?

From: hadley wickham <>
Date: Fri, 7 Dec 2007 10:15:03 -0600

On Dec 7, 2007 4:28 AM, Roger Levy <> wrote:
> I'm interested in writing a function that constructs a new plot on the
> current graphics device if no plot exists there yet, but adds lines to
> the existing plot if a plot is already there. How can I do this? It
> seems to me that the exists() function might be co-opted to do this, but
> it's not obvious how.

You might want to look at the ggplot2 package,, which exposes plots as objects that can be easily manipulated.



______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Fri 07 Dec 2007 - 16:20:51 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 07 Dec 2007 - 16:30:17 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.