Data Transformation II

Week 11, Spring 2022


This week we will continue our discussion of the tidyverse. In particular, we’ll discussion data import and export, tidying data, and joining data.

  • Note: Due to Engineering Open House, our usual classroom will not be available, so there will be no in-person class on Friday, March 31.

Learning Objectives

After completing this week, you are expected to be able to:

  • Identify “tidy” data.
  • Transform untidy data to tidy data using tidyr, in particular:
    • pivot_wider to transform long data to wide data
    • pivot_longer to transform wide data to long data, which is most often tidy
  • Import and export data using readr.
  • Combine multiple datasets using joins from dplyr.


Link Source
Introduction R4DS
Data Visualization R4DS
Workflow: Basics R4DS
Data Transformation R4DS
Workflow: Code Style R4DS
Data Tidying R4DS
Workflow: Scripts and Projects R4DS
Data Import R4DS
Workflow: Getting Help R4DS
Joins R4DS
Moneyball in R Instructor Website


Link Source
ggplot2 Posit Cheatsheets
dplyr Posit Cheatsheets
readr Posit Cheatsheets
tidyr Posit Cheatsheets



Title Link Mirror
11.1 - Data Transformation: Import, Pivots, and Joins 11.1 - YouTube 11.1 - ClassTranscribe
11.2 - Moneyball in R 11.2 - YouTube 11.2 - ClassTranscribe
11.3 - Lab 07 11.3 - YouTube 11.3 - ClassTranscribe


Assignment Deadline Credit
Lab 06 Thursday, March 30 100%
Quiz 06 Thursday, March 30 105%
Lab 07 Thursday, April 6 100%
Quiz 07 Thursday, April 6 105%

Office Hours

Staff and Link Day Time
Zoom with Abdi Tuesday 11:00 AM - 12:00 PM
Zoom with Mallory Wednesday 9:00 AM - 10:00 AM
Zoom with Zhiyuan Wednesday 4:00 PM - 5:00 PM
Zoom with Dave Wednesday 5:00 PM - 7:00 PM
Zoom with Zhiyuan Thursday 9:00 AM - 10:00 AM
Zoom with Abdi Thursday 11:00 AM - 12:00 PM
Zoom with Mallory Thursday 1:15 PM - 2:15 PM
Discussion Forum Any! Any!