[R] retaining characters in a csv file

Rolf Turner r.turner at auckland.ac.nz
Wed Sep 23 03:19:24 CEST 2015


On 23/09/15 12:48, Duncan Murdoch wrote:

> On 22/09/2015 6:33 PM, Rolf Turner wrote:

<SNIP>

>> IMHO this is a bug in read.csv().
>
> No, it's a bug in "Rolf Turner", who believes in fairies at the end of
> his garden, rather than in documentation for file formats.

Naturally, I beg to differ.

The documentation for read.csv() refers to a quote character.  Nowhere 
does it mention that quotes only serve to keep commas and white space 
from being interpreted as delimiters.  The usual meaning of quotes in R 
is to enclose character strings and so it is a reasonable assumption 
that this would be their function in this instance.

Before you fly off into some idiotic rant about how one "should never 
make assumptions" consider the fact that if one made no assumptions at 
all one could not get out of bed in the morning.  One has to assume that 
the documentation is reasonably consistent and that any serious 
inconsistencies are drawn to the user's attention.  If one had to read 
the (entire) documentation for each system called upon by a given piece 
of software (apply recursively!) then one would spend one's entire life 
reading documentation and never get any work done.

Although I most definitely do not believe in fairies at the bottom of my 
garden, I am the first to admit that I am not all that bright and could 
have erringly missed something.  HOWEVER Terry Therneau was flummoxed by 
the quirky and counter-intuitive nature of quotes in read.csv(), and Dr. 
Therneau is very bright indeed.

So the fault is not in the user/reader but in the function and its 
documentation.

cheers,

Rolf

-- 
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276



More information about the R-help mailing list