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

From: Henrique Dallazuanna <wwwhsd_at_gmail.com>
Date: Fri, 7 Dec 2007 08:33:57 -0200

Try this:

if(length(dev.list()) == 0) plot(rnorm(100), type="l") else (lines(rnorm(100)))

On 07/12/2007, Roger Levy <rlevy_at_ucsd.edu> 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.
>
> Many thanks,
>
> Roger
>
> --
>
> Roger Levy Email: rlevy_at_ucsd.edu
> Assistant Professor Phone: 858-534-7219
> Department of Linguistics Fax: 858-534-4789
> UC San Diego Web: http://ling.ucsd.edu/~rlevy
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Fri 07 Dec 2007 - 10:36:56 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 - 11:30:17 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.