devtools is integral to a happy workflow.Although we’ll build a very simple package, we’re still going to use the most modern and powerful tools for R package development. In theory, this could eventually involve compiling C/C++ code, which means you need what’s called a “build environment.” Follow the link above for help preparing your system.
We build the gameday package to check if your favorite NHL team has a game today.
This fully developed example shows you
devtools and RStudio during developmentDay 1 of hands-on work
Day 2 of hands-on work
Homework that builds on the in-class work on gameday. Hints on how to get started. Peer review help.
R packages is a work-in-progress by Hadley Wickham. To be published as a book by O’Reilly in 2015. Already a valuable resource:
Hilary Parker’s blog post on the epiphany of writing her first R package
October 2014 blog post announcing release of devtools v1.6 gives a nice overview of the latest helper functions for package developers
Karl Broman’s guide to writing an R package
Karl Broman covers package development in his course Tools for Reproducible Research
Jeff Leek’s guide to writing R packages
Building and Maintaining R Packages with devtools and roxygen2, blog post by Jacob Montgomery and Ryan T. Moore
Writing Package Vignettes, slides for a November 2013 talk by Duncan Murdoch
Roxygen vignette on Generating Rd files
testthat: Get Started with Testing, an article written by Hadley Wickham for The R Journal, Vol. 3/1, June 2011, pp. 5-10. This may no longer be correct in every last detail, due to evolution of testthat, but it still makes an excellent, readable introduction to unit testing in R (packages).
Writing R Extensions, the One True Official Document on creating R packages