# Install pacman if not installed already, and activate it
if (!require("pacman")) install.packages("pacman")
# Install, update and activate libraries
pacman::p_load(
here,
rio,
janitor,
flextable,
gtsummary,
tidyverse)Prepare for the course
Installation, libraries and data
Install R, Rtools and Rstudio
Participants need to have R, RTools, and RStudio installed in their computer. Preferably, the installation of these applications should be done in the stated order: R >> RTools >> RStudio. If you don’t have these applications installed yet, please do so following the instructions below:
R should be installed in the participants’ computer. You can download it from here, on the section “Download and Install R”. Select the adequate version to your computer’s operating system.
Latest version available is 4.6.1 (24th Jun 2026). You don’t need the latest version installed. However, it’s highly recommended to stay updated on at least the ‘major version’ (4.x.x) and not too many ‘minor versions’ (x.6.x) away, as packages tend to update to each of them. A warning message might show when using p_load if your R version is older than a package’s last update; however, it will work fine.
R usually requires administrative rights to be installed in your work computer.
Multiple versions of R can be installed in one’s computer. If you have more than one R version installed on your computer, please make sure that you select the latest version when running RStudio (Top Menu: Settings > Global Options > Left Panel > R)
RTools (Windows users only) should also be installed in the participants’ computer. You can download the necessary files by clicking here and selecting the latest available version (4.5 as of summer 2026)
- For MacOS, RTools installation comprises the minimal installation of clang and gfortran as listed in the hyperlinked website. Usually the installation is automatic not requiring any active action from the user like in Windows
RStudio can be used with previous versions without creating conflict with packages or R versions safely. Try to keep updated if possible.
Libraries
The following R packages have to be installed. Open RStudio, copy the highlighted code below into the R Console pane and press enter. This process might take several minutes.
Data
To download all neccessary datasets and files for this practicals, click in this link and then save the zip file in the data folder of your project.