[datatable-help] Auto-convert characters to factors when settings keys?
Matthew Dowle
mdowle at mdowle.plus.com
Fri Jun 4 01:48:50 CEST 2010
On Tue, 2010-05-25 at 09:33 -0400, Steve Lianoglou wrote:
> Also, you suggested to try data.table(df) instead of
> as.data.table(df), but this doesn't change anything with respect to
> the behavior of setting key on a character column:
>
> R> df <- data.frame(a=LETTERS[1:10], b=1:10, stringsAsFactors=F)
> R> dt <- data.table(df)
> R> key(dt) <- 'a'
> All keyed columns must be storage mode integer
>
> Or
>
> R> dt <- data.table(df, key='a')
> Error in setkey(value, a) :
> All keyed columns must be storage mode integer
>
Thats strange. I thought it would. I added bug #953 to the tracker for
this one, so we don't forget to come back to this thread. Thanks for
reporting that.
Matthew
More information about the datatable-help
mailing list