[datatable-help] Playing nice(r) with S4?
Tom Short
tshort.rlists at gmail.com
Tue Nov 23 19:56:46 CET 2010
> About as.data.table I had to remind myself about auto-conversion.
Matthew, I'm glad you checked as I was just going from memory.
> It seems it's just the
> 'data.table(letters[1:5],letters[6:10])' form that does do
> auto-conversion of atomic character vectors to factor. Should
> we remove the auto-conversion in that form then, for
> consistency? I think we said setkey() would be the only place
> auto-conversion happens going forward since that's where it's
> required.
That would probably work fine for most of my uses, but I'm worried
about consistency with data frames. data.frame defaults to
auto-conversion and has a stringsAsFactors argument that defaults to
default.stringsAsFactors() that in turn uses
options('stringsAsFactors'). Here's a tentative vote for adding a
stringsAsFactors argument that works like data.frame's. The down sides
are an added argument and use of a global option.
Also, I sometimes want factors mainly for grouping operations, and
that doesn't involve setkey.
- Tom
More information about the datatable-help
mailing list