I need to read a text file (tab-separated) that has some carriage returns inside some fields.
If I use read.table, it gives me an error:
line 6257 did not have 20 elements
If I use read.csv, it doesn't give an error, but creates a new line in that place, putting the next fields in the first fields of the new line.
How can I avoid this? I can't alter the file itself (the script is to be run elsewhere). Also the broken strings don't have quotation marks (no strings in the file have). One option would be to read the carriage return as a single space, or as \n, but how?
Use read.table instead of read.csv and set allowEscapes to TRUE.
I tested w/ the following:
contents of csv file:
result: