> fread('a,b,c,d\n1e1,1e2,1e3,"4,0001"\n1,2,3,4\n', dec=',')
a b c d
<num> <num> <num> <num>
1: 10 100 1000 4.0001
Warning message:
In fread("a,b,c,d\n1e1,1e2,1e3,\"4,0001\"\n1,2,3,4\n", dec = ",") :
Discarded single-line footer: <<1,2,3,4>>
In addition, the "Details" section in documentation has the following information (which is long since being outdated):
‘fread’ uses C function ‘strtod’ to read numeric data; e.g.,
‘1.23’ or ‘1,23’. ‘strtod’ retrieves the decimal separator (‘.’ or
‘,’ usually) from the locale of the R session rather than as an
argument passed to the ‘strtod’ function. So for
‘fread(...,dec=",")’ to work, ‘fread’ changes this (and only this)
R session's locale temporarily to a locale which provides the
desired decimal separator.
This happens because float parser greedily consumes
1,2as a single token, whereas without quotes it must be parsed as 2 separate fields.In addition, the "Details" section in documentation has the following information (which is long since being outdated):