NYCFlights23

Author

Andrew Marshall

library(tidyverse)
Warning: package 'tidyr' was built under R version 4.3.3
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.4     ✔ readr     2.1.5
✔ forcats   1.0.0     ✔ stringr   1.5.1
✔ ggplot2   3.4.4     ✔ tibble    3.2.1
✔ lubridate 1.9.3     ✔ tidyr     1.3.1
✔ purrr     1.0.2     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(nycflights23)
Warning: package 'nycflights23' was built under R version 4.3.3
data("flights")
flights23 <- flights |>
      select(dep_time, dep_delay) |>
      group_by(carrier = "UA", origin = "EWR")|>
      filter(dep_time > 2200)|>
      head(10)
flights23
# A tibble: 10 × 4
# Groups:   carrier, origin [1]
   dep_time dep_delay carrier origin
      <int>     <dbl> <chr>   <chr> 
 1     2201        31 UA      EWR   
 2     2202         3 UA      EWR   
 3     2205         6 UA      EWR   
 4     2206        10 UA      EWR   
 5     2207        38 UA      EWR   
 6     2207         8 UA      EWR   
 7     2209        70 UA      EWR   
 8     2210        40 UA      EWR   
 9     2211        18 UA      EWR   
10     2212        37 UA      EWR   
library(viridis)
Warning: package 'viridis' was built under R version 4.3.3
Loading required package: viridisLite
ggplot(data = flights23, aes(x = dep_time, fill = dep_delay)) +
  geom_bar(alpha = .8, position = "dodge")+
  scale_fill_brewer()+
       labs(x = "Departure Time", y = "Departure Delay", 
       title = "Departure Delays for United Airlines at Newark Airport - Late Night",
       caption = "From FAA Airport Registry")
Warning: The following aesthetics were dropped during statistical transformation: fill
ℹ This can happen when ggplot fails to infer the correct grouping structure in
  the data.
ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
  variable into a factor?

This barplot shows how late flights were late at night departing Newark airport (New Jersey, very near New York City) with United Airlines. The delay is shown on the Y axis per departure time on the x axis. Each departure time has it’s own delay on a scale, not in minutes or parts of a hour. Interestingly, Most of the delays are around One on this scale, with only the one time frame being around 2 units of a delay.