NYC Flights Assignment

Author

Gerardo Sandoval

Load the libraries

library(tidyverse)
── 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.0     ✔ 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)
data(flights)
dep_flight <- flights %>%
  filter(month == 6) %>%
  count(origin) %>%
  arrange(-n) %>%
  head(8) %>%
  ggplot(., aes(x = reorder(origin, -n), y = n, fill = origin)) +
  geom_bar(stat = "identity") +
  theme_minimal() +
  scale_fill_brewer(palette = "Accent") +
  geom_label(aes(label = n), vjust = -0.2, label.size = NA, fill = "yellow") +
  labs(title = "Highest Deperature Locations In June",
       x = "Departure Location",
       y = "Count")
       caption = "Source: Flights23"

dep_flight

For my visualization I decided to use a bar graph to examine where the majority of the departures occur in the month of June. There are three locations you can depart from. We can notice that LGA holds the highest amount of deparatures for the month of June.