dplyr basics: Pipe

  • |> = pipe symbol
  • Pronounced “and then”
  • Pipes data from one function into 1st arg of next
flights |>
  filter(dest == "IAH") |> 
  group_by(year, month, day) |> 
  summarize(
    arr_delay = mean(arr_delay, na.rm = TRUE)
  )
  • “Take the flights dataset,
  • and then filter the flights that have their destination (dest) as ‘IAH’,
  • and then group these filtered results by year, month, and day,
  • and then for each group, calculate the average arrival delay (arr_delay), ignoring the missing values.”