[R] Making an S3 object act like a data.frame
Gabor Grothendieck
ggrothendieck at gmail.com
Thu Mar 9 15:42:42 CET 2006
Can you create a small self contained reproducible example
that does not work? The reproducible example I provided earlier on
this thread worked fine.
One idea is to check what the class is of the output of
your .GGobiCall. If it were of class ggobiDataset then
it would in turn be calling as.data.frame.ggobiDataset
again. I mention this since the problem in
your reproducible example was precisely of that
sort.
On 3/9/06, hadley wickham <h.wickham at gmail.com> wrote:
> > > 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.
> >
> > Did you write an as.data.frame method? From ?model.frame
>
> My as.data.frame is :
>
> "as.data.frame.ggobiDataset" <- function(x, ...) {
> as.data.frame(.GGobiCall("getData", x))
> }
>
> (which in the context of my problem retrieves the data corresponding
> to x, an external pointer to a ggobi dataset)
>
> I still get the error reported above.
>
> Hadley
>
> >
> > data: 'data.frame', list, 'environment' or object coercible to
> > 'data.frame' containing the variables in 'formula'. Neither
> > a matrix nor an array will be accepted.
> >
> > so I believe that an as.data.frame method is all that is required.
> >
> > --
> > Brian D. Ripley, ripley at stats.ox.ac.uk
> > Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
> > University of Oxford, Tel: +44 1865 272861 (self)
> > 1 South Parks Road, +44 1865 272866 (PA)
> > Oxford OX1 3TG, UK Fax: +44 1865 272595
> >
>
> ______________________________________________
> R-help at 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
>
More information about the R-help
mailing list