Set up R for the case studies

Part of Data & Code.

The case study code runs on a reproducible R environment. Packages are pinned with renv: renv::restore() installs the exact versions recorded in the lockfile, so your results match the book.

Two ways to start

  • No install (recommended for starters): run everything in the browser with GitHub Codespaces — pre-configured for R, nothing to set up locally.
  • Local setup: follow the R setup guide (renv) — install R and RStudio, then restore the environment.

The setup guides are maintained alongside the code, so they always match the current version. See Data & Code for the datasets and folder setup.