使用data.table :: fread读取文本文件

时间:2018-01-26 14:59:35

标签: r csv data.table

当我使用函数readLines时,这样的数据。

enter image description here

我可以使用readLines获取此类数据,如何在data.table::fread中执行此操作。

train <- fread("./data/train_first.csv", encoding = 'UTF-8', quote="", fill=TRUE)

这是错误:

Error in fread("./data/train_first.csv", encoding = "UTF-8", fill = TRUE) : 
  Expecting 3 cols, but line 99771 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.

0 个答案:

没有答案