── 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.2 ✔ tibble 3.3.0
✔ lubridate 1.9.4 ✔ tidyr 1.3.1
✔ purrr 1.1.0
── 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)
flights_sum <- flights |>group_by(month, carrier) |>summarize(num_flights =n(), .groups ="drop") |>left_join(airlines, by ="carrier")ggplot(flights_sum, aes(x = month, y = num_flights, fill = name, group = name)) +geom_area(position ="stack", alpha =0.9) +labs(title ="Monthly Airline Flight Activity in New York City (2023)",x ="Month (1 = Jan, 12 = Dec)",y ="Number of Flights",caption ="Source: nycflights23 dataset, Data 110 Unit 5 Notes",fill ="Airline" ) +theme_minimal()
Essay Part
The graph I created is a streamgraph that shows the number of flights departing from New York City in 2023, separated by airline and month.Using dplyr, I grouped the data by month and airline to count how many flights each airline operated. Each color in the graph represents a different airline, and the width of each section shows how many flights that airline had in a given month. From the graph, we can see that the number of flights changes throughout the year, with the busiest months being around summer (June and July). Airlines like United, Delta, and JetBlue stand out because they consistently have the largest sections, meaning they operated the most flights. The visualization makes it easy to see which airlines were the most active and how flight activity changed over time during 2023.