[datatable-help] Auto-convert characters to factors when settings keys?
Short, Tom
TShort at epri.com
Tue May 25 15:39:47 CEST 2010
> -----Original Message-----
> From: Steve Lianoglou [mailto:mailinglist.honeypot at gmail.com]
> Sent: Tuesday, May 25, 2010 09:33
> To: Short, Tom
> Cc: mdowle at mdowle.plus.com; datatable-help at lists.r-forge.r-project.org
> Subject: Re: [datatable-help] Auto-convert characters to
> factors when settings keys?
> > A couple of utility functions to do in-place raw
> conversions would be
> > useful:
> >
> > setdf(d) # changes class to "data.frame", creates the "row.names"
> > attribute
> > # possibly removes the "sorted" attribute
> > setdt(d) # changes class to "data.table", possibly deletes
> "row.names"
> >
> > This avoids a copy. I haven't needed them enough to write them, yet.
> > This might be something to consider if we're making a
> change related
> > to conversions.
>
> 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.
- Tom
More information about the datatable-help
mailing list