Preparation Course

In this course we will be using R, RStudio and Git. We ask you to install and/or update these programs before the start of the course, so that we do not loose time once the course starts. In this chapter, we cover the course requirements and some tips on how you should change your RStudio settings.

Install or update R (not RStudio)

If you haven’t installed R yet, do so now by getting the newest version from CRAN. If you do have R installed, check your Version of R by opening RStudio and typing the following command into the console.

R.version.string
[1] "R version 4.3.1 (2023-06-16)"

This returns the version number of your R installation, whereas the first digit (4) indicates the number of the major release, the second digit (3) indicates the minor release and the last digit (1) refers to the patch release. As a general rule of thumb, you will want to update R if you

  • don’t have the current major version or
  • are lagging two (or more) versions behind the current minor release

In the time of writing (April, 2024), the current R Version is 4.4.0 (released on 24.04.2024, see cran.r-project.org). Your installation should therefore not be older than 4.3.0.

If your current installation is older, make sure that you have updated R before the course. Check these instructions on how to update R

Install or update RStudio

RStudio is the IDE (integrated development environment) we use in our course to interact with R. There are good alternatives you can use, RStudio simply seems to be the most popular choice. If you want to use your own IDE, please feel free to do so. However, we don’t recommend this if you are a beginner.

We recommend updating RStudio to the newest version before the course: check if this is the case by clicking on help > check for updates.

Install the necessary packages

In the course, we will be needing several packages. Save time during the course by installing these upfront! The classical way to install a package (e.g. pacman) is as follows:

install.packages("pacman")

However, the function install.packages does not check whether you already have the package installed. If you only want to install missing packages, you can use the function p_install with the option force = FALSE (from the package pacman).

library("pacman")

p_install("dplyr", force = FALSE)
p_install("ggplot2", force = FALSE)
p_install("readr", force = FALSE)
p_install("tidyr", force = FALSE)
p_install("sf", force = FALSE)
p_install("terra", force = FALSE)
p_install("tmap", force = FALSE)
p_install("zoo", force = FALSE)
p_install("units", force = FALSE)
p_install("plotly", force = FALSE)
p_install("patchwork", force = FALSE)

Configure RStudio

Now we will set some RStudio Global options. Go to Tools → Global options.

  • R General
    • Deactivate the option “Restore .RData into workspace at startup1
    • Set “Save workspace to .RData on exit” to “Never2
  • Code
    • Activate the option “Use native pipe operator, |> (requires R 4.1+)3
  • R Markdown
    • Deactivate the option “Show output inline for all R Markdown documents

Click on “Ok” to apply the change and close the options menu.


  1. We recommend that you start each RStudio session with a blank slate, as recommended by Wickham and Grolemund (2017) see here↩︎

  2. If we don’t restore the workspace at startup, there is no need to save it on exit.↩︎

  3. Our group has adapted the native pipe operator |> to reduce package dependencies. If you use the magrittr pipe %>% and would like to stick to it, feel free.↩︎