Want to help out or contribute?

If you find any typos, errors, or places where the text may be improved, please let us know by providing feedback either in the feedback survey (given during class), by using GitLab, or directly in this document with hypothes.is annotations.

  • Open an issue or submitting a merge request on GitLab.
  • Hypothesis Add an annotation using hypothes.is. To add an annotation, select some text and then click the on the pop-up menu. To see the annotations of others, click the in the upper right-hand corner of the page.

3 Pre-course tasks

Complete everything in this pre-course tasks section and finish with completing the survey at the end.

3.1 Installing the latest programs

Given this is an intermediate course, you should already have R and RStudio installed. However, you may not have the latest versions installed.

  1. Have the latest version of R installed (preferably >4.0.0, but it is fine if you have at least 3.6.0).
  2. Have the latest version of RStudio installed (preferably the latest 1.3 version, but at least 1.2.5001 is fine).

There are a few other things to install:

  1. Git. We’ll be using Git (building off of the Introduction course), so it needs to be installed.
  2. For some Windows users, you may need to install Rtools in order for some R packages to be installed (which you’ll do shortly).

All these programs are required for the course, even Git. Git, which is a software program to formally manage file versions, is used because of it’s popularity and the amount of documentation available for it. Check out the online book Happy Git with R, especially the “Why Git” section, to understand why we are using Git. Windows users tend to have more trouble with installing Git than macOS or Linux users. See the section on Installing Git for Windows for help.

A note to those who have or use work laptops with restrictive administrative privileges: You may encounter problems installing software due to administrative reasons (e.g. you don’t have permission to install things). For issues with updating to the latest version of R or RStudio, if you have at least 3.6.0 for R and at least 1.2.5001 for RStudio, that should be fine. If you have versions of R and RStudio older than that, it is necessary for you to request IT update your software if you can’t yourself. Unfortunately, given that Git is not a commonly used software for some organizations, you may not have it installed and you will need to ask IT to install it. We require it for the course, so please make sure to give IT enough time to be able to install it for you.

Once R, RStudio, and Git have been installed, open RStudio. If at any point during these pre-course tasks you have any troubles, try as best as you can to complete the task and then let me know about the issues in the pre-course survey (at the end of this section). If you continue having problems, indicate on the survey that you need help and we can try to book a quick video call to fix the problem. Otherwise, if you can, come to the course earlier (15-20 min) to get help.

3.2 Installing the R packages

We will be using specific R packages for the course, so you will need to install them. A detailed walkthrough for installing the necessary packages is available on the pre-course tasks for installing packages section of the beginner course, however, you only need to install the r3 helper package in order to install all the necessary packages:

  1. Install the remotes package:

  2. Install the helper package for this course, r3:

    remotes::install_gitlab("rostools/r3", upgrade = TRUE)

Note: When you see a command like something::something(), for example with remotes::install_gitlab(), you would “read” this as:

R, can you please use the install_gitlab function from the remotes package.

The normal way of doing this would be to load the package with library(remotes) and then running the command (install_gitlab()). But by using the ::, we tell R to directly use a function from a package, without needing to load the package. We use this trick because we only want to use the install_gitlab() command from the remotes package and not have to load all the other functions from remotes.

3.3 Setting up Git

Since Git has already been covered in the Introduction course, we won’t cover it during this course, but we will be using it (since version control should be part of any modern data analysis workflow, we’ll be using it as well). If you have used or currently use Git, you can skip this section. If you haven’t used it, please do these tasks:

  1. Follow the pre-course tasks for Git (not the GitHub tasks) from the beginner’s course. Specifically, type in the RStudio Console:

    # A pop-up to type in your name (first and last), 
    # as well as your email
  2. Read through the Version Control lesson of the beginner course. You don’t need to do any of the exercises or activities, but can if it helps you learn or understand it better.

Regardless of whether you’ve done the steps above or not, everyone needs to run


and eventually copy and paste the output into one of the survey questions.

3.4 Create an R project for the course

One of the basic steps to reproducibility and modern workflows in data analysis is to keep everything contained in a single location. In RStudio, this is done with projects. Please read all of Section 6.1 from the beginner course to learn about R Projects and keeping things self-contained. You don’t need to do any of the exercises or activities.

There are several ways to organise a project folder. We’ll be using the structure from the package prodigenr. The project setup can be done by either:

  1. Using RStudio’s New Project menu item: “File -> New Project -> New Directory”, scroll down to “Scientific Analysis Project using prodigenr” and name the project “LearnR3” in the Directory Name, saving it to the “Desktop” with Browse.
  2. Or, running the command prodigenr::setup_project("~/Desktop/LearnR3") in the Console.

When the RStudio Project opens up again, run these two commands in the Console:

usethis::use_r("functions", open = FALSE)

3.5 R Markdown

We teach and use R Markdown because it is one of the very first steps to being reproducible and because it is a very powerful tool to doing data analysis. Please do these two tasks:

  1. Please read over the R Markdown section of the beginner course. If you use R Markdown already, you can skip this step.

  2. Open up the LearnR3 project, either by clicking the LearnR3.Rproj file or by using the “File -> Open Project” menu. Run the function below in the Console when RStudio is in the LearnR3 project, which will create a new file called lesson.Rmd in the doc/ folder.


After the R Markdown document is created, please run this function in the Console:


And paste the output into the survey at the end.

3.6 Course introduction

Most of the course description is found in the syllabus. If you haven’t read it, please read it now. Read over what the course will cover, what we expect you to learn at the end of it, and what our basic assumptions are about who you are and what you know. The final pre-course task is a survey that asks some questions on if you’ve read and understood it.

One goal of the course is to teach about open science, and true to our mission, we practice what we preach. The course material is publicly accessible (all on this website) and openly licensed so you can use and re-use it for free! The material and table of contents on the side is listed in the order that we will cover in the course.

We have a Code of Conduct. If you haven’t read it, read it now. The survey at the end will ask about Conduct. We want to make sure this course is a supportive and safe environment for learning, so this Code of Conduct is important.

You’re almost done. Please fill out the pre-course survey to finish this assignment.

See you at the course!