Skip to content
Prev 86457 / 398513 Next

lattice: calling functions

On 2/14/06, Duncan Murdoch <murdoch at stats.uwo.ca> wrote:
data=NULL works too, which is apparently what lm has.  The point being
that the environment of the formula is looked at, but the default
data=parent.frame() subverts that because of the way eval works (using
enclos only when envir is a list or data frame. What's wrong with
environments?). Even the following works:

fun1 <- function( x=1:5, y=1:5, ... )
    fun2( y ~ x, data = data.frame(x = x), ... )

I don't understand non-standard evaluation all that well, so I'll
happily consider any suggestions. I'll try changing the defaults to
NULL and see if there are any obvious problems.

Deepayan