Error: Invalid: File is too small to be a well-formed file - error when using feather in R

Error: Invalid: File is too small to be a well-formed file - error when using feather in R

我正在尝试将 feather (v. 0.0.1) in R to read a fairly large (3.5 GB) csv file 与 21178665 行和 16 列一起使用。

我使用以下几行来加载文件:

library(feather)
path <- "pp-complete.csv"
df <- read_feather(path)

但是我得到以下错误:

Error: Invalid: File is too small to be a well-formed file

read_feather 的文档中没有解释,所以我不确定是什么问题。我想这个函数需要一个不同的文件格式,但我不确定那会是什么。

顺便说一句,我可以在 readr 库中使用 read_csv 读取文件,但需要一段时间。

feather 文件格式不同于 CSV 文件格式。它们不可互换。 read_feather 函数无法读取简单的 CSV 文件。

如果您想快速阅读 CSV 文件,最好的选择可能是 readr::read_csvdata.table::fread。对于大文件,从光盘读取它通常仍然需要一段时间。

将数据加载到 R 后,您可以使用 write_feather 创建一个 feather 格式的文件,以便下次使用 read_feather 读取它。