R for Psych
Preface & Overview
In this course you’ll learn how to use R for data analysis and presentation. This course has a particular focus on using R for psychology (hence the name), but it should be applicable to most cases in the social sciences. Here, we’ll primarily take a tidyverse first approach to R. This means we’ll be relying primarily on a collection of packages designed to get things done quickly, with highly readable syntax. We will still cover some of the base R functions and the basics of programming, but our aim is to quickly and efficiently use R for managing and processing data. Along the way, we’ll look into how R encourages open and reproducible science, and how R can be useful for managing your research projects as a whole.
By the time you’re finished, you will be able to tell R how (and where) to read input files (e.g. raw data from an experiment), how to perform operations on your data (e.g. data wrangling and aggregation), and how to produce and save ouputs based on your data (e.g. graphs and test statistics). You’ll also be able to produce documents that incorporate your R code with formatted text so every time you update your code, your written statistics, tables, and graphs update automatically. For this, we’ll explore R-markdown, specifically using R notebooks.
We will rely on the R for Data Science (R4DS) textbook by Garrett Grolemund and Hadley Wickham as a core text. Follow the link for a free online version of the book uploaded by the authors.
The above book assumes some familiarity with programming and/or R at the outset, but covers the basics in Chapter 4. As in this course, the aim here is to get you doing productive things (e.g. producing a graph) as quickly as possible. If, however, you feel like you’d prefer a basic grounding in R prior to doing so, you can check out R for Beginners by Emmanuel Paradis. This is a short introduction to all of the core concepts required for working with your data in R (including reading, manipulating, and saving data).
As this course focuses on using R for psychologists, we’ll cover a range of traditional parameteric and non-parametric analyses, such as:
We will also cover topics such as power analysis, particularly using simulation based methods (which are scalable for any set of tests), before we move on to more advanced methods, such as hierarchical mixed effects modelling (or linear mixed effects models; LMM). Throughout, we will use examples and assignments to entrench the concepts taught in this module.
Finally, we will focus on creating reproducible analyses and write-ups using R markdown.
To join the rest of your class in discussing this course, please join the R @ Abertay Slack channel. We will use this channel for all communications about the course, including help, hints, and tips about the course content.
To download the course content, get the lesson materials from my GitHub repo. Download all of the content from this course using the Clone or Download button, save the files as a zip, unzip them, and go to the lesson_materials folder. You can follow along with the slides using the R notebooks.