[R-pkg-devel] data function from utils package
Fox, John
jfox at mcmaster.ca
Tue Aug 16 21:48:25 CEST 2016
Dear Mike,
Perhaps it's stating the obvious, but why not save the .csv file with ";" as the delimiter using the sep argument to write.csv() or write.table(), or save as a .txt file with " " as the delimiter?
Although I don't know why ";" was chosen in preference to "," for data(), I doubt that it's a bug since the behaviour corresponds to what's in ?data, as you noted.
I hope this helps,
John
--------------------------------------
John Fox, Professor
McMaster University
Hamilton, Ontario, Canada
Web: socserv.mcmaster.ca/jfox
> -----Original Message-----
> From: R-package-devel [mailto:r-package-devel-bounces at r-project.org] On
> Behalf Of Mike Mehan
> Sent: Tuesday, August 16, 2016 3:29 PM
> To: r-package-devel at r-project.org
> Subject: [R-pkg-devel] data function from utils package
>
> Hi,
> I'm having trouble loading a csv file from my package data directory
> using the data() function. We have an external file that gets updated
> every month or so that we would like to include as data in our package.
> We are able to import it using the data function when it is saved as an
> R Data file but when we save it as a csv file it fails. I checked the
> help for data and it says that it supports csv files but it says that it
> calls read.table with the separator as a semi-colon instead of a comma.
> I checked the source code and it also uses a semi-colon. Is this a bug?
> I would be really nice to be able to use csv files since we refresh this
> file fairly often and I'd rather not have to save it as an R data file
> each time. We also got it working with system.file but using data() is
> much cleaner. Any suggestions?
> Thanks,
> Mike
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-package-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
More information about the R-package-devel
mailing list