Materials for writing an R Package
These are the materials associated with a one-hour workshop on writing an R Package.
A PDF of the presentation can be found here
There are many resources that the tutorial builds upon that are referenced in the presentation.
Briefly:
We created a package called "domR". It has 3 functions (dci
, get_di_matrix
, ttri
) and 2 datasets (caribou
, bonobos
).
The tutorial takes you through:
- setting up and naming a R package
- adding .R function files
- adding documentation to functions
- adding data files
- adding raw data files
- adding documentation to data files
- adding a vignette
- building the package
- running CRAN checks on the package
- how to install the package locally
- how to publish to GitHub or CRAN
The final package can be found in the domR
folder.
The other files include example .R files that we may wanted to put into a package, and files that we could adapt for documentation etc.
Please contact me for more info via the issues tab or @jalapic on twitter.