Working with dataframes

Introducing the tidyverse

This guide deliberately ignores many common patterns for working with dataframes.

There are plenty of other guides for working in these older ways, but for beginners, these techniques can be confusing. The approach shown here is based only on functions in the tidyverse. Although simple — and easy to read — the approach is extremely flexible and covers almost all of the cases you will encounter when working with psychological data.

Specifically, we make extensive use of two tidyverse packages:

  • dplyr: to select, filter and summarise data
  • ggplot2: to make plots

To load the tidyverse first write:


This can either be typed into the console or (better) included at the top of an markdown file.