1  R Setup

1.1 Installing R

This workshop is based in the R programming language. As such, it is necessary to have a recent version installed on your computer. I would suggest R version \(\geq\) 4.4.

These workshop materials were built and tested using R version 4.6.1 (Happy Hop, released 2026-06-26), with all packages updated on or after September 14, 2026.

1.2 Installing RStudio Desktop

Posit makes a wonderful integrated development environment (IDE) called RStudio Desktop. This was my preferred IDE for R; I’ve since started using VS Code because my organization offers an LLM coding assistant (see here) through that IDE. I will be using RStudio throughout the workshop, except for a brief demonstration of how LLM coding assistants work. Posit also makes Positron, a data-science code editor based on the VS Code editor framework.

I am using RStudio version 2026.01.2+418, which was installed on September 14, 2026. Newer versions are available; I am required to use this version by my organization.

1.3 Installing R Tools

Rtools is necessary to install or build R packages that require compilation of C, C++, or Fortran code, as it provides the necessary compiler toolchain and build tools. Packages available on CRAN usually do not require Rtools because CRAN provides precompiled binary packages for Windows.

Note that Rtools is Windows-specific. On macOS, compiling R packages may require the Xcode Command Line Tools (run xcode-select --install in Terminal) and a Fortran compiler; on Linux, you’ll typically need the build-essential package (or your distribution’s equivalent) along with development headers for R.

I’m not sure which packages downloaded from GitHub or other sources require compilation, so I recommend also installing Rtools 4.5 or newer. I’m using 4.5.6768. (And it’s just good to have in case you need it later.) You can confirm your build tools are set up correctly by running pkgbuild::has_build_tools(debug = TRUE) in the R console.