Classwork 6

Data Transformation with R - filter(), arrange(), and distinct()

Author

Byeong-Hak Choe

Published

October 5, 2026

NoteNote

Please complete the question in this Classwork, and submit your response in the corresponding Brightspace page.

Consider the nycflights13::flights data.frame.

library(tidyverse)
library(nycflights13)
flights <- flights

For detailed descriptions of the variables in this data frame, load its help documentation using the following command:

# Documentation for the `flights` data.frame from the `nycflights13` package
?flights   # displays the description of variables in the `flights` data.frame

Question 1

  • Find all flights that had an arrival delay of two or more hours.
  • Find all flights that flew to Houston (IAH or HOU).
  • Find all flights that departed in summer (July, August, and September).
  • Find all flights that arrived more than two hours late, but did not leave late.

Answer:



Question 2

  • How many flights have a missing dep_time?

Answer:



Question 3

  • Sort flights to find the most delayed flights.

Answer:



Question 4

  • Was there a flight on every day of 2013?

Answer:



Back to top