[datatable-help] Auto-convert characters to factors when settings keys?
mdowle at mdowle.plus.com
mdowle at mdowle.plus.com
Tue May 25 17:22:58 CEST 2010
Perhaps radical suggestion ... should/could we move to S4? Only user code,
or packages that call data.table would see the [.data.table signature,
otherwise the object would appear to be a data.frame to packages that
require data.frame. Not sure if this is possible or not - I did try once.
Also tried to inherit data.table from data.frame in S3 using
class(df)=c("data.table","data.frame"). As long as the package that only
works with data.frame uses is.data.frame() or inherits(), and not
class(x)=="data.frame", then it gets past that point but then [.data.table
is still dispatched rather than [.data.frame. I'm thinking S4 signatures
might another option if they can be local. Advantage being that no class
conversion would then be needed.
Above is from memory a few years back so may well be wrong. Plus R has
moved on in the meantime.
Tom, do you have a good example to hand where the data.table<=>data.frame
conversion causes grief (syntax as well as speed) that we could use for
testing ?
This also links to the not yet implemented .SDF object. The way I was
thinking to do that wouldn't allow use of both .SD and .SDF in the same j,
but it would be fast. Would be nicer not to need .SDF though if S4 works.
> On Tue, May 25, 2010 at 9:39 AM, Short, Tom <TShort at epri.com> wrote:
>
>>> I guess I don't understand why you'd want to make setdf and
>>> setdt instead of using the as.data.frame/as.data.table functions?
>>>
>>> Isn't the as.* more idiomatic S3-OOized R?
>>
>> You're right, it's not very standard for R, but if I have a 9-GB data
>> table, I may not want the memory consumption of keeping both copies
>> around. Because it's nonstandard, maybe it shouldn't be in data.table,
>> but it's worth discussing.
>
> Ahh ... good point.
>
> I see their use case now ;-)
>
> +1 for having something like these so people who know what they're
> doing can use them.
>
> --
> 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