[datatable-help] Adding Column to Data.Table not working
Steve Lianoglou
lianoglou.steve at gene.com
Tue Apr 1 20:12:55 CEST 2014
Hi,
On Tue, Apr 1, 2014 at 9:56 AM, bgoldstein <ben.goldstein at gmail.com> wrote:
> Up until a recent update (now 1.8.8) I would add a column to a DT the DF way:
It's not clear: are you saying that you are using data.table v1.8.8?
If so, could you upgrade to the latest (1.9.2) and try again?
> DT <- data.table(a=c(1,2,3), b=c(4,5,6))
> DT$c <- c(7:9)
>
> Or I could have done the DT way:
> DT[,c:=c(7:9)]
>
> However when I try to do this now I get the error:
>
>> DT$c = c(7:9)
> Error in `[<-.data.table`(x, j = name, value = value) :
> attempt to set index 2/2 in SET_STRING_EL
I can't explain why this is happening, even in your earlier version
(it shouldn't be), but let's all get on the same page first then we
can continue w/ the debugging.
The output of sessionInfo() after you get this error would also be most helpful.
Thanks,
-steve
--
Steve Lianoglou
Computational Biologist
Genentech
More information about the datatable-help
mailing list