christophergandrud / repmis

Miscellaneous tools for reproducible research with R.
24 stars 9 forks source link

source_RData function #11

Closed MansMeg closed 9 years ago

MansMeg commented 9 years ago

Hi!

Thanks for the Ada suggestions. I miss a function to read in Rdata-files from GitHub so I added one to your package and there is no example. I have not written any test, but it does work for me. It almost just a copy of source_data().

It passed CRAN checks.

Regards Måns

christophergandrud commented 9 years ago

Thanks @MansMeg for putting this together.

One favour: could you send over an example URL. Ideally I'ld like to consolidate this into source_data and want to test it out.

MansMeg commented 9 years ago

Hi!

I thought of putting it into source_data() but I thought the differences between load() and read.table() were to large to have it in the same function.

Here is an example URL (but I dont think it will work as an example in the long term): https://github.com/MansMeg/KursSvyMeth/raw/master/Labs/DataFiles/svy2010.Rdata

Regards Måns

christophergandrud commented 9 years ago

I think the dot notation makes it easy for users to set arguments for either plain-text or RDATA within the same source_data function.

Have a look at the new source_data in the master branch and let me know what you think!

MansMeg commented 9 years ago

Hi!

I think it is easier to have a separate function (like source_Xlsxdata) instead of trying to have everything in one function, I think it would enhance the readability of the code and reduce the risk of errors. (Maybe one could modularize the core/caching to use in both.)

If you want to have everything in one I think it would easier to manually specify if it is an R dataset instead of reading it from the extention of the file with an argument like rdata=FALSE? Otherwise it must conform to ".Rdata"-standards. I also think that, as an example, dta-files can be Stata files as well?

Anyway, good work!

Regards Måns