I am trying to load integer64
as character
in fread
?fread
indicates that the integer64
argument is not implemented but the options(datatable.integer64)
is. Though fread keeps loading as int64
.
How can I tell fread
to load as character
. EDIT [If colClasses
is the answer, I think it does not allow to specify a single column name or index and the table I load has tens of columns so unpracticable... => This was WRONG]
Here is a sample
#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 ...