[R] Making an S3 object act like a data.frame

hadley wickham h.wickham at gmail.com
Thu Mar 9 18:15:40 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.

I wish I could, and I'm very grateful for the help, but because the
data is an external pointer it's not easy to make a self-contained
example.

> str.default(x)
Classes ggobiDataset  and `data.frame': 32 obs. of  1 variable:
Classes 'ggobiDataset', 'data.frame' <externalptr>
 - attr(*, "ggobi")=Class 'ggobi' <externalptr>
> getAnywhere("str.default")$objs[[1]](x)
Classes 'ggobiDataset', 'data.frame' <externalptr>
 - attr(*, "ggobi")=Class 'ggobi' <externalptr>

> 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.

> class(x)
[1] "ggobiDataset" "data.frame"
> class(as.data.frame(x))
[1] "data.frame"

So I don't think that's the problem.

Thanks again for your help.

Hadley




More information about the R-help mailing list