> I tend to have to use trial and error myself.  Here is another
> possibility.

That's got the subsetting solved, so here's the next challenge

> lm(x ~ y, z)
Error in as.data.frame.default(data) : cannot coerce class "myobj"
into a data.frame
> as.data.frame.myobj <- function(x) x[[1]]
> lm(x ~ y, z)
Error in eval(expr, envir, enclos) : numeric 'envir' arg not of length one

I'm guessing this is pretty much impossible to get around, because
there is no way to tell eval how to deal with myobj type objects, and
lm only dispatches based on the type of the first argument.

Hadley

______________________________________________
[email protected] 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