Slides available on speakerdeck
devtools
creates 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.
In class example that that shows how to
devtools
and RStudioIn 2016 and 2015, we built the foofactors
package, to make the care and feeding of factors less aggravating.
foofactors
from where we left off in class.Writing R Extensions, the One True Official Document on creating R packages.
R packages from Hadley Wickham. The above lessons follow it and the devtools
package workflow quite faithfully. devtools
on CRAN, on GitHub.
Hilary Parker’s blog post on the epiphany of writing her first R package
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
Some blog posts accompanying devtools
releases highlight useful helper functions for package developers:
devtools
Cheat Sheet is also super helpful. Remember links to the cheat sheets are always available from RStudio Help > Cheatsheets.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).
How R Searches and Finds Stuff is a fairly technical blog post for understanding the R search path, but also gives some great explanations on some differences between Imports
vs Depends
and why Imports
is safer.