Hi:
I have a function as follows:
 my.plot    <- function( x, y = NULL, ... )
{
  plot( x, y, cex.axis=0.5, ...)
}

Set up the variables:
x <- 1:10; y <- x; tdf <- data.frame( x, y ); main.str <- "test"

I will exercise the function in two ways:

> my.plot( y ~ x, tdf, main = "test" )
This works fine

> my.plot( y ~ x, tdf, main = main.str )
Error in eval(expr, envir, enclos) : 
  ..1 used in an incorrect context, no ... to look in

Turns out that plot.formula is looking for the name "main.str" in its parent 
frame. If I define the name main.str in my.plot the function works fine.

Is this a bug?
I have a clunky workaround where I get the parent.frame in my.plot and create 
the variables in my.plot, but I don't like the solution. 

Thanks

______________________________________________
R-help@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.

Reply via email to