── 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.5.1 ✔ tibble 3.2.1
✔ lubridate 1.9.4 ✔ 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)
nycflights <- flights |>arrange(time_hour) |>ggplot(aes(time_hour, arr_delay, color = distance))+geom_point()+geom_smooth(color ="#edd609", alpha = .5)+labs(x ="Date",y ="Average Arrival Delay (minutes)",caption ="FAA Aircraft registry",title ="Arrival Delays by Date from Flights to NY",fill ="Distance Traveled (miles)")nycflights
`geom_smooth()` using method = 'gam' and formula = 'y ~ s(x, bs = "cs")'
Warning: Removed 12534 rows containing non-finite outside the scale range
(`stat_smooth()`).
Warning: Removed 12534 rows containing missing values or values outside the scale range
(`geom_point()`).
This assignment was a lot of fun, and r was actually pretty compliant with what I was trying to get it to do. My first thought was to do exactly what I was doing here, except also facet wrapping it by the origin airport. I thought that maybe that was going to reveal something interesting, perhaps one of the airports had more delays. Unfortunately, all the airports had basically the same exact scatterplot. However, that did lead me to making this final visulization. One thing I like about this graph is that the yellow line of best fit has a small bump right over both spring break and summer break. Another thing that I thougth was interesting was that the majority of very delayed flights were ones not traveling that far, while many of the flights that arrived early were ones traveling really far. If I had the time and ability to look into this more, I would look into what happened during that one spike right before October, since that didn’t seem to coincide with any major holidays.