Last updated: Thu Sep 11 09:50:41 2025

This module is designed to teach students the basic skills needed to conduct quantitative research in R. It covers data handling, data tidying, plotting, and analysing datasets. This is not meant to be a comprehensive guide to R (such a thing would be almost impossible!). Rather, this module is designed to be a gentle introduction to R, cover statistical techniques that are common in psychological research, and provide a solid base where you can investigate advanced techniques on your own. This website contains material covered in the demonstrations of the module. Additional “extra” pages are also available that introduce new concepts for students looking for an additional challenge. Weekly exercises are also available to students completing HPSP131 on Canvas.

Syllabus

Each week, we will be tackling the following topics:

  1. Introduction to R.
  2. Datasets in R.
  3. Data cleaning and data skills.
  4. Plotting data using ggplot2.
  5. t-tests and one-way ANOVAs.
  6. Correlation and regression.
  7. Moderation - multiple regression and two-way ANOVAs
  8. Power analyses and mediation.
  9. Structural Equation Modelling (Path Analysis)
  10. Mixed Effects Modelling (Multilevel Modelling)

Weekly Exercises

For students completing HPSP131, exercises are available each week and are designed to reinforce content. These exercises are split into basic and advanced sections. It is expected that students can complete the basic sections of each weekly exercise, with the advanced sections designed for students who want an extra challenge or learn additional functions in R. If you can successfully complete these exercises, then you should be able to easily complete the marked assessments. Exercises are available on the HPSP131 Canvas page.

Before You Start…

Complete The Survey

Within these demonstrations, we will be analysing real data collected in a survey at the beginning of semester. Before beginning the first demonstration, it is a good idea to complete this survey yourself, as 1) it will give you an idea on how the data we are analysing was collected, and 2) if no one does the survey, then we won’t have any data to analyse!

You can access the survey by clicking here.

Download R

R is a free software environment for statistical computing and graphics. If you already have R installed on your computer, make sure you have the latest version. Otherwise, you can follow the instructions below to install R. R can be installed on most computers and laptops, but cannot generally be installed on tablets or Chromebooks.

Note: Throughout the process of installing R and RStudio, do not change directories or roots. Always select the default options. Changing options can break links and cause many headaches down the line.

  1. Click here to go to the R download website (UK)
  2. Select your operating system (Linux, MacOS, or Windows).
  3. Windows users will want to click the ‘base’ subdirectory after selecting Windows, then click the Download R for Windows link. Mac users will want to download the most recent .pkg file.
  4. Select the latest release for your operating system to download to your computer.
  5. Open the downloaded file and follow the instructions.

Windows Users

Windows users will also need to download an additional extension called Rtools.

  1. Click here to go to the Rtools download site.
  2. Select the recommended version of Rtools.
  3. Open the downloaded install file and follow the instructions.

Tip: Sometimes RStudio installs correctly but does not create a desktop icon. If this happens, search for “RStudio” using the Start menu (bottom-left Windows button).

Download RStudio

RStudio provides a graphical user interface for R. It is designed to make R easier to use. All content from this module will be conducted in RStudio.

  1. Click here to go to the RStudio download website.
  2. Select the RStudio Desktop version.
  3. Select the version for your operating system (Linux, MacOS, Windows, etc.)
  4. Open the downloaded file and follow the instructions.

Note: Installing both R and RStudio will create two different icons. For this module, always open RStudio (not R).

Make sure to open RStudio and not R
Make sure to open RStudio and not R

Resources

Many online tutorials are available for learning R that can be used to compliment the materials here. If you are feeling overwhelmed, or just looking for additional content, try some of the following courses:

  1. Swirl
  2. RStudio Webinars
  3. R for Reproducible Scientific Analysis
  4. datacamp
  5. Google “r tutorials” for more or ask ChatGPT.

Note: Often there are more than one way to do things in R. During this module, I will primarily be teaching R using the tidyverse packages, but you may find other ways to achieve the same objective. In all cases, you should go with the method that makes the most sense to you.