'Embedded nul in string' error when importing csv with fread
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")
In this case, you can use read.csv
with fileEncoding of UTF-16LE rather than fread
.
read.csv("mycsv.csv",fileEncoding="UTF-16LE")
Considering your data size, using read.csv
would take a couple of minutes, but I think it is not a big deal.