From peter.meilstrup at gmail.com  Tue Oct  1 15:25:57 2013
From: peter.meilstrup at gmail.com (Peter Meilstrup)
Date: Tue, 1 Oct 2013 06:25:57 -0700
Subject: [Rd] read.table() with quoted integers
In-Reply-To: <CAJoaRhZcuJ-5PJr_k760NzQUkWVWVri4490H+oPb_6=Rd6Kapw@mail.gmail.com>
References: <1380544403.10008.15.camel@milan>
	<CAPPM_gQBkwtbTR4Wv2gLp4_qHQpzqSHM=pZD8tRPYAD=uewgKg@mail.gmail.com>
	<1380552319.10008.20.camel@milan>
	<CAO1zAVYh3HTSYdFW4zxBbh8ZbdSLA73utxR0k3NrxKt06xf0EQ@mail.gmail.com>
	<CAJoaRhZcuJ-5PJr_k760NzQUkWVWVri4490H+oPb_6=Rd6Kapw@mail.gmail.com>
Message-ID: <CAJoaRhb+6k-Miz69AZxq1GUvmC1TUBoDkNXOSRaaWEaJxVyMJg@mail.gmail.com>

On Tue, Oct 1, 2013 at 5:50 AM, Peter Meilstrup
<peter.meilstrup at gmail.com> wrote:
>
> On Mon, Sep 30, 2013 at 8:10 AM, Joris Meys <jorismeys at gmail.com> wrote:
>>
>> Regardless of whether "stored as character" is interpreted the R way or the
>> ASCII way, the point Joshua makes is rather valid. Mainly because
>> read.table has an argument quote with default value \"'. This means that at
>> least according to R, everything between either " or ' should be seen as of
>> type character and not integer.
>>
>> The only way these quotes can end up in a .csv file, is when in the
>> rendering program (often Excel), these integers are called "character"
>> inside the program as well. So they're not treated as integers by the
>> person that created the file, so R won't treat them
>> as integers either. Note that read.table does read the quoted integers as
>> characters, and only afterwards convert those.
>>
>> So yes, this is an issue with read.table.ffdf more than with R itself. And
>> the problem is indeed how integers are treated *the moment they are stored*.
>> This refering to the presence/absence of the quote character.
>
>
> This assumes too much about the program that creates the file.
>
> Quoted numeric values may be necessary in non-American locales which use the comma as decimal separator. (CSV files written in these locales often use something other than the comma for the field separator, but this is not required.)
>

Additionally, while CSV is a somewhat nebulous format, most attempts
at specifying it are clear that a quoted value, containing no special
characters, is to be treated _identically_ to the unquoted version.
The reason for the quote is to escape special characters which may be
present, not to impart type information. A CSV producing program may
simplify the logic of writing a file by always quoting, whether or not
the field would contain special characters when rendered.

http://www.creativyst.com/Doc/Articles/CSV/CSV01.htm -- "When
importing CSV, do not reach down a layer and try to use the quotes to
impart type information to fields."

Peter



[Rd] read.table() with quoted integers
Peter Meilstrup