本文介绍了fread()读取大数为4.076092e-309的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

原始数字是从 825010211307012 825010304926185 的整数。 fread()将所有这些数字转换为 4.076092e-309

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

read.table 正常工作,但是我需要读取大数据,所以我无法使用它。

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

如何纠正此错误?

推荐答案

如果安装 bit64 包,然后 fread 将使用它来读取这些大整数:

If you install the bit64 package then fread will use it to read these large integers:

之前:

> 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 has read them into 64 bit integers:

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

我不知道为什么当 bit64 不可用时,读取会误读它们。我至少会期待一个警告...

I don't know why fread misreads them when bit64 isn't available. I'd at least expect a warning...

这篇关于fread()读取大数为4.076092e-309的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 09:51