Warning message: line appears to contain embedded nulls [duplicate] Warning message: line appears to contain embedded nulls [duplicate] r r

Warning message: line appears to contain embedded nulls [duplicate]


The solution, as posted in a comment by @G. Grothendieck, was to use the fileEncoding= argument to specify the correct encoding, which turned out to be either UTF16LE or UCS-2LE according to the OP.

Writing this as an answer so that is not lost to the comments.


I faced similar issue recently where I received an error message like:

1: In read.table(file = file, header = header, sep = sep, quote = quote, : line 3 appears to contain embedded nulls.

I tried resetting the fileEncoding parameter but failed to remove the warnings. Fortunately, I came across SkipNul argument mentioned in this link and setting it to T worked for me.


I agree with the other users that the fileEncoding argument can help. Be sure to also check that the function and file type are correct. I ran into this error when mistakenly trying to use read.csv() to load in Excel file (the error was resolved quickly when I switched to read.xlsx()).