[R-pkg-devel] Data-generating scripts in R packages

Enrico Schumann es at enricoschumann.net
Wed Mar 23 11:46:50 CET 2016


On Tue, 22 Mar 2016, Kevin Coombes <kevin.r.coombes at gmail.com> writes:

> Hi,
>
> 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?
>
> Best,
>   Kevin

If the script is short, you could wrap it in \dontrun{...}
and put it into the Examples section of the Rd file that
describes the data. In this way people can quickly find the
code when they look up the data's documentation.


Kind regards
    Enrico


-- 
Enrico Schumann
Lucerne, Switzerland
http://enricoschumann.net



More information about the R-package-devel mailing list