[datatable-help] Weird behavior with S4 subclasses of data.table after loading RCurl
Steve Lianoglou
mailinglist.honeypot at gmail.com
Mon Oct 1 20:26:33 CEST 2012
Hi Jeffrey,
On Mon, Oct 1, 2012 at 1:39 PM, Jeffrey Arnold <jeffrey.arnold at gmail.com> wrote:
> (Sorry, Steve; I realized that I originally replied to you instead of the
> list)
[snip]
> I hadn't realized that I was doing something unintended when I started, or
> maybe I wouldn't have :-)
Actually, it wasn't so unintended after all -- I had written a trivial
test (inst/tests/test-S4.R) to see that we could inherit (contains)
from data.table, but I never kicked the tires with "[" and stuff, so
...
> Now R supports S4 classes inheriting from S3
> classes pretty well, so it seemed like a good idea at the time. The S4
> class I am actually writing is for storing / manipulating MCMC samples. One
> way to do that is to have a data.frame like object with specific columns,
> e.g. "chain", "iteration", "parameter", ..., and then add functions that
> take advantage of this known structure. I want to inherit from the
> data.frame directly so that it can make use of all the generic functions
> defined for the data.frame. It is more intuitive to use object[...] rather
> than object at someSlotName[...].That all works great, except that these get
> samples can get pretty big, so, of course, I want the performance of
> data.table :-) if I can have it.
I agree that it would be handy to do what you want this way ... I am
unfortunately a bit short on time to help you dig into this at the
moment.
I think the "[" methods you are defining for data.table are on the
right track -- perhaps it will be a good idea to include these into
the data.table package and export them. Still, one package
simultaneously (and fully) supporting s3 and s4 might be a bit ...
something.
-steve
--
Steve Lianoglou
Graduate Student: Computational Systems Biology
| Memorial Sloan-Kettering Cancer Center
| Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact
More information about the datatable-help
mailing list