[R-pkg-devel] Data-generating scripts in R packages
Brian G. Peterson
brian at braverock.com
Tue Mar 22 14:15:09 CET 2016
On Tue, 2016-03-22 at 08:52 -0400, Kevin Coombes wrote:
> I'm currently developing an R package that includes a small data set
> along with the functions that I want to export. I have an R script that
> generates the data set; the computation time is long (well, relative to
> the size of the data set). So, my plan is to run the script and save()
> the data set as an *.rda file that I can put in the data directory. (It
> is possible that some users of the package will _only_ be interested in
> the data set.)
>
> But, I'd like to keep the script with the package, both because it shows
> how to use some of the functions and because I might want to modify how
> the data set is generated in the future. My question: What is the "best
> practice" for where in the package directory structure to store such a
> script?
I'd probably put the script in the 'demo' directory so that it would be
easy for a user to run it.
My team has taken to documenting things like that as RStudio notebooks
(.R files with rmarkdown comments that may be compiled as an annotated
document), but that's just a suggestion and certainly not necessary.
The other place things like this could go would be in the inst/
directory. We have a package that includes several 'parser' scripts for
different data providers, and we chose to include these in a directory
under inst/
Regards,
Brian
More information about the R-package-devel
mailing list