在r中读取int载体,每个int读取4个字节



我有一个1 GB文件,该文件为250m元素,每个元素是4字节int(用C 保存)。

如何将其加载到R向量?这是自然的方式吗?

f = file("myfile.dat")
readBin(f, integer(), n = 250000000, size = 4, endian = "little")

实际上问题只是开放的binary模式:

f = file("myfile.dat", open="rb")
readBin(f, integer(), n = 250000000, size = 4, endian = "little")

最新更新