fread() reads big number as 4.076092e-309

时间:2017-07-10 15:17:43

标签: r data.table fread

The original numbers are integers from 825010211307012 to 825010304926185. fread() turns all those numbers to 4.076092e-309.

read.table works normally, but I need to read large data so I can't use it.

How can I correct this error?

1 个答案:

答案 0 :(得分:3)

如果您安装了bit64包,那么fread将使用它来读取这些大整数:

之前:

> fread("./bignums.txt")
              V1
1: 4.076092e-309
2: 4.076092e-309

做魔术:

> install.packages("bit64")

然后:

> fread("./bignums.txt")
                V1
1: 825010211307012
2: 825010304926185

fread已将它们读入64位整数:

> fread("./bignums.txt")$V1
integer64
[1] 825010211307012 825010304926185

我不知道freadbit64不可用时误导他们的原因。我至少期待一个警告...