R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

library(ggplot2)
ggplot(flights, aes(x = factor(month))) +
  geom_bar(fill = "steelblue") +
  labs(
    title = "Number of Flights by Month",
    x = "Month",
    y = "Number of Flights"
  )

library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.2.1     ✔ stringr   1.6.0
## ✔ forcats   1.0.1     ✔ tibble    3.3.1
## ✔ lubridate 1.9.5     ✔ tidyr     1.3.2
## ✔ purrr     1.2.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
flights %>%
  group_by(origin) %>%
  summarise(
    avg_delay = mean(dep_delay, na.rm = TRUE)
  ) %>%
  ggplot(aes(x = origin, y = avg_delay, fill = origin)) +
  geom_col() +
  labs(
    title = "Average Departure Delay by Airport",
    x = "Departure Airport",
    y = "Average Departure Delay (minutes)"
  ) +
  theme(legend.position = "none")