[Rd] read.csv

Gabor Grothendieck ggrothendieck at gmail.com
Sun Jun 14 20:56:01 CEST 2009


If read.csv's colClasses= argument is NOT used then read.csv accepts
double quoted numerics:

1: > read.csv(stdin())
0: A,B
1: "1",1
2: "2",2
3:
  A B
1 1 1
2 2 2

However, if colClasses is used then it seems that it does not:

> read.csv(stdin(), colClasses = "numeric")
0: A,B
1: "1",1
2: "2",2
3:
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,  :
  scan() expected 'a real', got '"1"'

Is this really intended?  I would have expected that a csv file in which
each field is surrounded with double quotes is acceptable in both
cases.   This may be documented as is yet seems undesirable from
both a consistency viewpoint and the viewpoint that it should be
possible to double quote fields in a csv file.



More information about the R-devel mailing list