r - data.table is not handling integer64 in by statement -
using fread data.table load integer64 correctly, though have impression by statements not handling int64 correctly. doing someting wrong here, ?
library(data.table); library(bit64); test = data.table(x=c(1,2,3),y=c('x','q','q'),id=as.integer64(c('432706205348805058','432706205348805058','432706205348805059'))) str(test) #the display wrong (but expected) #classes ‘data.table’ , 'data.frame': 3 obs. of 3 variables: # $ x : num 1 2 3 # $ y : chr "x" "q" "q" # $ id:class 'integer64' num [1:3] 9.52e-280 9.52e-280 9.52e-280 # - attr(*, ".internal.selfref")=<externalptr> test # here displayed correctly # x y id #1: 1 x 432706205348805058 #2: 2 q 432706205348805058 #3: 3 q 432706205348805059 txtr) test$id integer64 [1] 432706205348805058 432706205348805058 432706205348805059 txtr) test[,list(count=.n),by=id] #wrrrong id count 1: 432706205348805058 3
update: implemented in v1.9.3 (available r-forge), see news :
o
bit64::integer64works in grouping , joins, #5369. james sams highlighting upcs , clayton stanley.
reminder:fread()has been able detect , readinteger64while.
on op's example above:
test[, .n, by=id] # id n # 1: 432706205348805058 2 # 2: 432706205348805059 1 integer64 isn't yet implemented data.table operations such setkey or by. implemented in fread (first released cran on 6 march 2013) first step. useful value column example.
i may have confused matters filing bug report relating (the 1 @arun linked to). strictly speaking, isn't bug feature request. think of bug list more 'important things resolve before next release'.
contributions welcome.
Comments
Post a Comment