Skip to content

Double quotes!

November 14, 2006

GGGRRrrrrrrr … I was quietly using R to analyse my data when, suddently, I wasn’t able to open the file containing these data anymore. It’s just a plain text file! How can it be corrupted? Here is the error message:

t < - read.table('ratsdata.csv', header=TRUE, sep=",")
Warning message:
incomplete final line found by readTableHeader on 'ratsdata.csv'

For hours, I tried everything: I counted the number of separators on each line, I counted the number of decimal points on each line, I removed double quotes around factors, I examined in details the final line, etc. (well, Python scripts did the job for me because my file already has > 700 lines). Finally, the solution was so dumb: I mistakenly deleted one double quote before a header. My first line looked like (1) and should look like (2):

1: "id", "group", "trial", "durTot", durExt" [...]
2: "id", "group", "trial", "durTot", "durExt" [...]

Ok, next time, I’ll add this check on my list …

From → Lab life

Comments are closed.

%d bloggers like this: