3.1 Read in data & load libraries

Load the libraries of the necessary packages prior to reading in the bab9 data file in the manner described in Practical 8. This can be done with the code below:

#--- Load libraries - always load the tidyverse last to avoid conflicts - make sure you have installed packages with install.packages()
library(epiDisplay)
library(foreign)
library(psych)
library(tidyverse)

#--- Change output options: R will not show scientific notation and will round every number to three digits (the default is 7).
options(scipen = 10, digits=3) 

#--- Change theme: This ensures our plots come out with a white background
theme_set(theme_bw()) 

#--- Read in the bab9 data file
bab9 <- read.dta("./BAB9.dta", convert.factors = T)