KentonWhite / ProjectTemplate

A template utility for R projects that provides a skeletal project.
http://projecttemplate.net
GNU General Public License v3.0
623 stars 159 forks source link

Feature Request: Move data import of csv data to "readr" functions (part of "tidyverse") #255

Open shainen opened 6 years ago

shainen commented 6 years ago

Right now, ProjectTemplate automatically imports csv files with read.csv (the default function for this kind of thing from the "utils" package). It does irritating things like convert spaces in column names to periods.

Included in the "tidyverse" is the "readr" package, which has nicer functions to import rectangular data. For csv, there is read_csv. Since there is already momentum to make ProjectTemplate inline the tidyverse, this seems worth doing.

I believe it is mostly accomplished by changing "read.csv" to "read_csv" in csv.reader.R, but there may be more to it.

Possible problem would be backwards compatibility for projects already started; using the new library would mean the names of data_frame's would be different (e.g. now spaces in original column names in csv would now be preserved).

rsangole commented 6 years ago

@KentonWhite and @Hugovdberg , this has been on my mind for a while too, and I believe it'll be part of #230 at the very least. read_csv is certainly a lot better than read.csv: it's faster (5x-10x), handles columns better, and returns a tibble, among other things.

Hugovdberg commented 6 years ago

I agree we should move to the tidyverse, there is the issue of backward compatibility. This should definitely be something for the 1.0 version of ProjectTemplate because a lot of old scripts are going to fail.