Last updated: Thu Oct 17 16:41:22 2024

This module is designed to teach students the basic skills needed to conduct quantitative research in R. This module covers basic data skills, data tidying, plotting data, and analysing datasets in R. 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. Weekly exercises are also provided that are designed for you to practice your R skills, and introduce new concepts for students looking for an additional challenge.

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

Exercises are available each week and are designed to reinforce content. These exercises are split into basic and advance 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.

Click here to download this week’s exercises.

Before You Start…

Complete The Survey

Within these workbooks, we will be analysing real data collected in a survey at the beginning of semester. Before beginning the first workbook, 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 be installed on tablets and some 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.

Also note, for Windows users, sometimes after going through the RStudio install process, RStudio may be installed properly on your computer but did not create an icon on the desktop. You may need to search for RStudio in the menu (the button in the bottom left corner) to find it.

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 FREE RStudio Desktop Open Source License option.
  3. Select the version for your operating system (Linux, MacOS, Windows, etc.)
  4. Open the downloaded file and follow the instructions.

Note: Downloading both R and RStudio will usually results two different icons that can be opened to start R. For all material in this course, make sure to open RStudio, and 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. ComputerWorld Tutorial
  5. datacamp
  6. tryR
  7. coursera
  8. leada
  9. Google “r tutorials” for more.

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.