From ggrothendieck at gmail.com  Thu Jun 15 13:45:28 2006
From: ggrothendieck at gmail.com (Gabor Grothendieck)
Date: Thu, 15 Jun 2006 07:45:28 -0400
Subject: [Rd] separators in data()
In-Reply-To: <449141A4.6090905@bfro.uni-lj.si>
References: <449141A4.6090905@bfro.uni-lj.si>
Message-ID: <971536df0606150445w1a45be29ie91cd35bb905ecd2@mail.gmail.com>

I don't think the poster is confused.  He is referring to the data()
command and
that one uses semicolon, not comma, and the poster is wondering what the
motivation is for that choice.  From ?data

     Currently, four formats of data files are supported:

        1.  files ending '.R' or '.r' are 'source()'d in, with the R
           working directory changed temporarily to the directory
           containing the respective file.

        2.  files ending '.RData' or '.rda' are 'load()'ed.

        3.  files ending '.tab', '.txt' or '.TXT' are read using
           'read.table(..., header = TRUE)', and hence result in a data
           frame.

        4.  files ending '.csv' or '.CSV' are read using
           'read.table(..., header = TRUE, sep = ";")', and also result
           in a data frame.

On 6/15/06, Gregor Gorjanc <gregor.gorjanc at gmail.com> wrote:
> Ben,
>
> you confused read.csv and read.csv2. Separator in read.csv is ",", while
> it is ";" in read.csv2. This is due to use of different decimal symbols
> in some european languages - mine is one of them  and I really hate
> this. So the situation is:
>
>                      decimal separator
> english               .       ,
> some european lang.   ,       ;
>
> There is then of course also a need to handle decimal separator and this
> is done in read.csv2.
>
> >   just out of curiosity:
> >
> >   why is the default behavior in data() for reading in .csv files
> > to use sep=";" (semicolon rather than comma)?  is this a historical
> > artifact of some sort, or is there other logic to it?  It caught
> > me by surprise since I was expecting it to be sep="," as in
> > read.csv() ...
> >
> >   cheers
> >     Ben Bolker
>
>
> --
> Lep pozdrav / With regards,
>    Gregor Gorjanc
>
> ----------------------------------------------------------------------
> University of Ljubljana     PhD student
> Biotechnical Faculty
> Zootechnical Department     URI: http://www.bfro.uni-lj.si/MR/ggorjan
> Groblje 3                   mail: gregor.gorjanc <at> bfro.uni-lj.si
>
> SI-1230 Domzale             tel: +386 (0)1 72 17 861
> Slovenia, Europe            fax: +386 (0)1 72 17 888
>
> ----------------------------------------------------------------------
> "One must learn by doing the thing; for though you think you know it,
>  you have no certainty until you try." Sophocles ~ 450 B.C.
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



[Rd] separators in data()
Gabor Grothendieck