[datatable-help] How to use datatable in S4 class?
Steve Lianoglou
mailinglist.honeypot at gmail.com
Tue Feb 22 15:55:22 CET 2011
(Forgot to CC datatable-help, sorry):
setOldClass(c('data.frame'))
setOldClass(c('data.table', 'data.frame'))
Hi,
On Mon, Feb 21, 2011 at 10:04 PM, Peter Jackson <pj16 at cornell.edu> wrote:
>
> The following command
> setClass("ClusterGroup",representation=representation(dtDemand="data.table"))
> results in
> Warning message:
> undefined slot classes in definition of "ClusterGroup": dtDemand(class
> "data.table")
>
> I assume this means the class does not recognize data.table. Is there way to
> use data.table's in slots?
Yes,
I've actually been sitting on a patch for this for a long time due to
the difficulty of adding a unit test for this in the current framework
... long story, but I'll repost with an update on that in a separate
thread later.
It's simple to do what you want know, you'll need to have R run the
following lines before defining your class that contains data.table in
a slot:
setOldClass(c('data.frame'))
setOldClass(c('data.table', 'data.frame'))
Define your class after that, and it should work.
--
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