Appendix D — Setup

D.1 Setting up R

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

D.1.1 Step 1: Install R

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

D.1.2 Step 2: Install RStudio

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

D.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("palmerpenguins")
install.packages("Metrics")
install.packages("car")
install.packages("skimr")
install.packages("AER")
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(palmerpenguins)
library(Metrics)
library(car)
library(skimr)
library(AER)