'Embedded nul in string' error when importing csv with fread

后端 未结 6 1215
[愿得一人]
[愿得一人] 2020-11-29 08:56

I have a large file (3.5G) that I\'m trying to import using data.table::fread.

It was originally created from an rpt file that was opened as text and sa

6条回答
  •  执笔经年
    2020-11-29 09:39

    We can remove the null terminators on the command line using something like:

    sed 's/\\0//g' mycsv.csv > mycsv.csv
    

    Or as suggested by @marbel, fread allows you to pass the sed call inside the text. Such as:

    fread("sed 's/\\0//g' mycsv.csv")
    

提交回复
热议问题