正确使用fread
from data.table 加载integer64
,但我的印象是by
语句没有正确处理 int64。我可能在这里做错了什么,这是什么?
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 is wrong (BUT IT IS EXPECTED)
#Classes ‘data.table’ and '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 it is 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