[R] calling plot

Jeff Newmiller jdnewmil at dcn.davis.ca.us
Tue Feb 9 04:52:17 CET 2016


plotxy(y1~x1, XY, xlim=c(0, max(XY$x1)))
-- 
Sent from my phone. Please excuse my brevity.

On February 8, 2016 7:17:57 PM PST, Spencer Graves <spencer.graves at effectivedefense.org> wrote:
>I'm getting an interesting error:
>
>
> > plotxy <- function(x, ...){
>+   plot(x, ...)
>+ }
> > XY <- data.frame(x1=1:3, y1=4:6)
> > plotxy(y1~x1, XY, xlim=c(0, max(x1)))
>  Show Traceback
>
>  Rerun with Debug
>  Error in eval(expr, envir, enclos) : object 'x1' not found
>
>
>       The following work:
>
>
>plotxy(y1~x1, XY)
>plot(y1~x1, XY, xlim=c(0, max(x1)))
>
>
>     Within "plotxy", R can't find "x1" to compute "xlim".  Is there a 
>way I can make x1 available to xlim?
>
>
>       Thanks,
>       Spencer
>
>______________________________________________
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>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.

	[[alternative HTML version deleted]]



More information about the R-help mailing list