On Sat, 1 Jan 2005, Gabor Grothendieck wrote:

Look at the source of expand.model.frame.

The second line of expand.model.frame uses the data component of mod$call
and if its not there expand.model.frame chokes.  As a workaround check
if its missing and supply it yourself:

if (is.null(mod$call$data)) mod$call$data <- environment(formula(mod))
expand.model.frame(mod, "z")

expand.model.frame should probably be doing that itself.


No, it shouldn't.

It should be setting data to as.list(NULL) if it is NULL.

I am surprised to find that
 y<-1:10
eval(quote(y), NULL, .GlobalEnv)
Error in eval(expr, envir, enclos) : Object "y" not found
eval(quote(y), as.list(NULL), .GlobalEnv)
[1] 1 2 3 4 5 6 7 8 9 10
eval(quote(y), as.data.frame(NULL), .GlobalEnv)
Error in eval(quote(y), as.data.frame(NULL), .GlobalEnv) :
        attempt to set an attribute on NULL

The third of these is definitely a bug, and I thought the first used to work (and that I would have noticed when writing expand.model.frame if it didn't).

        -thomas

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to