在f中导入巨大的csv文件在R中不起作用

时间:2017-07-31 08:28:26

标签: r csv data.table readr

我想在R中导入一个大的csv文件(大约1400万行和13列)。所以我尝试使用fread与以下代码:

my_data <- fread(my_file,
                 sep = ";",
                 header = TRUE,
                 na.strings=c(""," ","NA"),
                 quote = "",
                 fill = TRUE,
                 check.names=FALSE,
                 stringsAsFactors=FALSE))

但是,我收到以下错误:

Error in fread(path_alertes_profil, sep = ";", header = TRUE, na.strings = c("",  : 
  Expecting 13 cols, but line 18533 contains text after processing all cols. Try again with fill=TRUE. Another reason could be that fread's logic in distinguishing one or more fields having embedded sep=';' and/or (unescaped) '\n' characters within unbalanced unescaped quotes has failed. If quote='' doesn't help, please file an issue to figure out if the logic could be improved.

因此,我尝试使用read_delim包中的函数readr导入我的文件,并使用相同的参数。它起作用,因为我的文件出现在全球环境中(我正在使用RStudio)。但是,它只有741629行,而不是1400多行

如何解决此问题(我在使用fread()时尝试找到错误的解决方案,但没有找到任何有用的资源)

0 个答案:

没有答案