我正在尝试加载,integer64
因为表明该参数未实现但已实现。虽然 fread 一直加载为.character
fread
?fread
integer64
options(datatable.integer64)
int64
我怎么知道fread
加载为character
. 编辑[如果colClasses
是答案,我认为它不允许指定单个列名或索引,并且我加载的表有几十列,所以不切实际... => 这是错误的]
这是一个示例
#for int 64
library(bit64)
#for fast everything
library(data.table)
#here is a sample
df <- structure(list(IDFD = structure(c(5.13878419797985e-299, 5.13878419797985e-299,
+ 5.13878419797985e-299, 5.13878419797987e-299, 5.13878419797987e-299,
+ 5.13878419797987e-299, 5.13878419797987e-299, 5.13878419797987e-299,
+ 5.13878419797988e-299, 5.13878419797988e-299), class = "integer64")), .Names = "IDFD", row.names = c(NA,
+ -10L), class = c("data.table", "data.frame"))
#write the sample to file
write.csv(df,"test.csv",quote=F,row.names=F)
#I can't load it as characters
options(datatable.integer64='character')
str(fread("test.csv",integer64='character'))
Classes ‘data.table’ and 'data.frame': 10 obs. of 1 variable:
$ IDFD:Class 'integer64' num [1:10] 5.14e-299 5.14e-299 5.14e-299 5.14e-299 5.14e-299 ...