Photo by Hunter Haley on Unsplash

Package Development

The key to well-documented, well-tested and easily-distributed R code is the package. . You’ll also learn roxygen2 to document your code so others (including future you!) can understand what’s going on, and testthat to avoid future breakages. The class will consist of a series of demonstrations and hands on exercises.

Topics:

  • Package basics The basic structure of a package, where to put code, and the workflow that allows you to take your package code out for a test drive.
  • Documentation and namespaces For your code to be useful, it must be well-documented. We’ll solve these problems with roxygen2 with documentation, and rmarkdown for vignettes and READMEs.
  • Automated testing Maintaining R code requires advanced planning. You can simplify debugging, spot errors, and ensure that your package is stable by creating unit tests with the help of testhat.
  • Releasing your package We’ll work through R CMD check, and the process of distributing your package on GitHub or CRAN.

Target audience: This class will be a good fit for you if you’ve developed a number of R scripts, and now you want to learn:

  • a more efficient workflow, iterating between writing code and checking that it works
  • how to document your code so others (including future you!) can understand what’s going on
  • automated testing principles, so that if you accidentally break something in your code you find out right away
  • how to package and distribute your code to others, whether it’s inside your research group, your company, or to the whole world.

Instructions: Participants should bring a laptop setup to build R packages. Detailed instructions are available here.

Talks

The key to well-documented, well-tested and easily-distributed R code is the package. This half day class will teach you how to make …

Talk on R package development best practices. Focuses on using the devtools package and associated workflows to improve your rate of …