R – Incomplete final line when trying to read csv in R

csvend-of-lineexcelmacosr

I've got R v.2.15.1 running on Mac OS 10.8.2 . Earlier today, R started throwing errors at me every time I try to import ANY recently created (today) csv files. Older (before today) csv files work fine, but anything I create that's new will not read in without a warning.

I'm creating the csv's the same way — saving the spreadsheet as .csv in MS Excel (Office for Mac 2011).

Even with a dummy file ('test.csv'), I get this:
"Warning message:
In read.table(file = file, header = header, sep = sep, quote = quote, :
incomplete final line found by readTableHeader on 'test.csv'"

in TextEdit, test.csv is:

cat,stuff
1,1
2,2

I have tried hitting enter at the end of every line (as suggested here: 'Incomplete final line' warning when trying to read a .csv file into R ) , but this doesn't work.

I've re-installed R and Microsoft Excel. Weirdly, I was able to read in the csv file without a warning on a Windows machine with R. On another Mac with R and also with RStudio, I get the same warning…

I know this is "just" a warning, but it makes me a bit nervous and seems to have the potential to cause problems in the future.

Best Answer

There is no basis for worry. R's read functions are "expecting" to have an empty line but they are not resulting in malformed dataframes.

Related Topic