Chapter 3: Data transformation

Set up

We have already loaded the R packages you need for this tutorial. Once you start working in RStudio, you will run code like the code shown below to load the R packages you need.

Exercises

All exercises are from R for Data Science 2nd Edition.

Ex 1 in Section 3.2.5

In a single pipeline for each condition, find all flights that meet the condition:

  • Had an arrival delay of two or more hours

  • Flew to Houston (IAH or HOU)

  • Departed in summer (July, August, and September)

  • Arrived more than two hours late but didn’t leave late




Ex 3 in Section 3.5.7

How do delays vary over the course of the day? Illustrate your answer with a plot.


Ex 6 in Section 3.5.7

Suppose we have the following tiny data frame:

For each of the following, what you think the output will look like? Check if you were correct by running the chunk.

Open code chunk

Here is a code chunk in case you wish to play around with some code