I have a problem with fread () reading a directory path column using "\" as a directory delimiter. The problem is that the directory trailing separator throws an error in fread ().
In the example csv file below,
file,size
"windows\user",123
and fread () and read.csv () agree, and both convert \ to \\
> fread("example.csv")
file size
1: windows\\user 123
However, for the following example, fread () gives an error, while read.csv () is fine.
file,size
"windows\user\",123
read.csv () gives
> read.csv("example.csv")
file size
1 windows\\user\\ 123
So far, the fread () error looks like this:
> fread("example.csv",verbose=TRUE)
Input contains no \n. Taking this to be a filename to open
File opened, filesize is 0.000 GB
File is opened and mapped ok
Detected eol as \r\n (CRLF) in that order, the Windows standard.
Using line 2 to detect sep (the last non blank line in the first 'autostart') ... sep=','
Found 2 columns
First row with 2 fields occurs on line 1 (either column names or first row of data)
All the fields on line 1 are character fields. Treating as the column names.
Count of eol after first data row: 2
Subtracted 1 for last eol and any trailing empty lines, leaving 1 data rows
Error in fread("example.csv", verbose = TRUE) :
' ends field 1 on line 1 when detecting types: "windows\user\",123
I would really like to avoid
DT = data.table(read.csv("example.csv"))
if at all possible.