[Rd] Incorrect Import by Data for CSV File

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Sep 25 14:27:25 CEST 2017


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



More information about the R-devel mailing list