From ripley at stats.ox.ac.uk  Mon Sep 25 14:27:25 2017
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Mon, 25 Sep 2017 13:27:25 +0100
Subject: [Rd] Incorrect Import by Data for CSV File
In-Reply-To: <SY3PR01MB0747080D898AADCAABADDD53CD7A0@SY3PR01MB0747.ausprd01.prod.outlook.com>
References: <SY3PR01MB0747080D898AADCAABADDD53CD7A0@SY3PR01MB0747.ausprd01.prod.outlook.com>
Message-ID: <8b659650-9632-cf7c-a41a-82d688336444@stats.ox.ac.uk>

On 25/09/2017 08:00, Dario Strbenac wrote:
> Good day,
> 
> The data function can import a variety of file formats, one of them being C.S.V. 

That isn't its documented purpose.  It was the original way for packages 
to provide datasets as needed (before lazy data was added).

Problematically, all of the table columns are collapsed into a single 
data frame column. This occurs because "files ending .csv or .CSV are 
read using read.table(..., header = TRUE, sep = ";", as.is=FALSE)". I 
suggest that the semi-colon used as the column separator be changed to a 
comma.

We suggest you read the documentation ... the (non-English-locales) 
version with a semicolon separator is one of four documented formats, 
and the English-language one is not.  Even if it were desirable it would 
not be possible to make a backwards-incompatible change after almost 20 
years.

It really isn't clear why anyone would want to use anything other than 
the second option (.rda) for data() unless other manipulations are 
needed (e.g. to attach a package).  But that option was not part of the 
original implementation.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Emeritus Professor of Applied Statistics, University of Oxford



[Rd] Incorrect Import by Data for CSV File
Prof Brian Ripley