Appendix C — Setup

C.1 Setting up R

To get started, ensure you have a recent version or R and RStudio installed.

C.1.1 Step 1: Install R

To install R head to https://cran.rstudio.com/ and follow the instructions for your operating system.

C.1.2 Step 2: Install RStudio

Next, install RStudio Desktop IDE at https://posit.co/download/rstudio-desktop/.

C.1.3 Packages

To install the required packages, we run the install.packages("packagename") function.

# Install the required R packages for our analysis (first time use only)
install.packages("tidyverse")
install.packages("rmarkdown")
Note

The command install.packages() is only required the first time loading a new package or following any substantial updates. The library() command must be run every time you start an R session. To save potential issues arising from unloaded packages, put any library() commands at the beginning of any script file.

You should be able to now run the following commands:

# Load the installed packages at the start of each session
library(tidyverse)
library(rmarkdown)