[datatable-help] An implicit factor for a key?

Chris Neff caneff at gmail.com
Thu Aug 25 16:38:29 CEST 2011


Hi all,

I've been pondering the following. One of my coworkers doesn't like
data.table because of the fact that he doesn't like factors.  Namely
things like adding a new value to a factor field only to have it choke
because it isn't one of the levels.  Also often times the variable is
something like a list of subnested categories, and sometimes he will
do a substitute to go up a level in the categories. This is a pain
when they are factors.

Suffie to say, his work flow just makes a lot more sense to him when
they are characters and he doesn't have to worry about underlying
levels and the like.

How hard would an "implicit factor" be?  Something that to the user
behaves exactly like a normal character variable, but internally
data.frame is keeping the mapping of character values to integer codes
somewhere behind the scene.

This is my thrust towards a hack at allowing character vectors to be
keys.  If the real right way is much simpler than what this would take
please ignore me.

-Chris


More information about the datatable-help mailing list