3

I have a problem reading a csv in R. I use

logfile <- read.csv(path
                  ,header=TRUE
                  ,dec="."
                  ,quote="\""
                  , sep=","
                  ,colClasses=c("character","character"), 
                  stringsAsFactors = FALSE #?EOF problem
)

to read a csv. This command breaks in the middel of the csv with the message:

Warning message:
In scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,  :
  EOF within quoted string

Disabling the quoting does not work, because of some multiline entries in the file.

Here is an example file: http://www.file-upload.net/download-8867381/RAS_ERROR_ascii_reproducible.csv.html

How can I solve the problem?

Community
  • 1
  • 1
  • 2
    A minimal reproducible would help. – chl Apr 29 '14 at 12:33
  • 1
    possible duplicate of [read.csv warning 'EOF within quoted string' prevents complete reading of file](http://stackoverflow.com/questions/17414776/read-csv-warning-eof-within-quoted-string-prevents-complete-reading-of-file) – Carl Witthoft Apr 29 '14 at 12:41

1 Answers1

0

If you use data.table's fread it will throw an error but warn you to append a new line at the end of the file. If you follow this and append a "\r\n" to the end of the file, fread will read the file correctly (even with default parameters).

jan-glx
  • 7,611
  • 2
  • 43
  • 63