Hands-on workshop covering package building, automated testing, and designing code
Amelia McNamara, University of St Thomas
Onsite at the Minneapolis Federal Reserve August 10, 11, and 17, and online.
Hosted materials available at https://ameliamn.github.io/CodeYouCanBankOn/
- August 10th
- 9-10 am intro, review
- 10 am - 12 pm package dev
- 12-1 pm lunch break
- 1-4 pm documentation
- August 11th
- August 17th
- 9 am - 10 am misc
- 10 am - 12 pm side effects
- 12-1 pm lunch break
- 1-2 pm {testdat}
- 2-4 pm ? maybe tidy eval or more data in packages?
-
Ensure you have R and RStudio installed. You don't need the most recent version of either. I'm currently running R version 4.4.1 "Race for Your Life" and RStudio version 2026.07.
-
Install (or update!) the packages we're going to use. Even if you are certain you already have all these packages on your system, it's worth running install.packages() again, just to make sure you have recent versions.
install.packages(c("forecast", "fredr", "imputeTS",
"rlang", "roxygen2", "styler", "testthat",
"tidyverse", "usethis", "vdiffr"))
- [Optional, but recommended] Make sure your system is prepped to build more complex packages. We're not going to get into C/C++ packages here, but it's good to have the machinery to do more in-depth stuff. You can check your system's status with the
devtools::has_devel()function. If you don't get a positive response from that function, Jenny Bryan has instructions for getting up to speed:
I am assuming you have a baseline familiarity with
- R as a language
- Writing functions
- Markdown (RMarkdown/Quarto/plain Markdown)
- git
I'll do a little bit of review of each of those topics, but if they are totally new to you, here is some background reading to help you get caught up.
- R as a language
- Writing functions
- DRY
- Functions chapter of R for Data Science
- What makes a good function?, Hadley Wickham
- Nick Tierney's Practical Functions, Practically Magic
- Markdown
- git
All material is covered by a CC-BY-SA-4.0 license.
The material here is in turn based on other CC-BY products, primarily Building tidy tools workshop, uncoast::unconf day zero workshop, and R packages book.