[datatable-help] "by" on integer64 not working

Harish harishv_99 at yahoo.com
Sat Sep 14 21:05:29 CEST 2013


I am trying to use "by" on integer64 data and data.table seems to think that there is only one value.  This is reproduced with the following:

library( data.table )
library( bit64 )

DT <- data.table( a=rep( 1:5, 2), b=15:24 )
DT[ , .N, by=a ]
DT[ , a := as.integer64( a ) ]
DT[ , .N, by=a ]

The output I get is:


> DT <- data.table( a=rep( 1:5, 2), b=15:24 )
> DT[ , .N, by=a ]
   a N
1: 1 2
2: 2 2
3: 3 2
4: 4 2
5: 5 2
> DT[ , a := as.integer64( a ) ]
> DT[ , .N, by=a ]
   a  N
1: 1 10

Notice that the "by" after converting column "a" to integer64 is different from before.  However, the values of "a" are correct:

> DT$a
integer64
 [1] 1 2 3 4 5 1 2 3 4 5

I am using the latest version of data.table from r-forge (1.8.11 Rev 965).  I also had the same issue with 1.8.10 from CRAN.


Am I doing something wrong or is this a bug?  Thanks for your help.



Regards,
Harish
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/datatable-help/attachments/20130914/844d86c1/attachment.html>


More information about the datatable-help mailing list