NYC

Quarto

Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see https://quarto.org.

Running Code

When you click the Render button a document will be generated that includes both content and the output of embedded code. You can embed code like this:

1 + 1
[1] 2

You can add options to executable code like this

[1] 4

The echo: false option disables the printing of code (only output is displayed).

library(tidyverse)
Warning: package 'tidyverse' was built under R version 4.5.3
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.4     ✔ readr     2.1.6
✔ forcats   1.0.1     ✔ stringr   1.6.0
✔ ggplot2   4.0.2     ✔ tibble    3.3.1
✔ lubridate 1.9.4     ✔ tidyr     1.3.2
✔ purrr     1.2.1     
── 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(dplyr)
library(nycflights23)
Warning: package 'nycflights23' was built under R version 4.5.3
library(ggplot2)
data(flights)
head(flights)
# A tibble: 6 × 19
   year month   day dep_time sched_dep_time dep_delay arr_time sched_arr_time
  <int> <int> <int>    <int>          <int>     <dbl>    <int>          <int>
1  2023     1     1        1           2038       203      328              3
2  2023     1     1       18           2300        78      228            135
3  2023     1     1       31           2344        47      500            426
4  2023     1     1       33           2140       173      238           2352
5  2023     1     1       36           2048       228      223           2252
6  2023     1     1      503            500         3      808            815
# ℹ 11 more variables: arr_delay <dbl>, carrier <chr>, flight <int>,
#   tailnum <chr>, origin <chr>, dest <chr>, air_time <dbl>, distance <dbl>,
#   hour <dbl>, minute <dbl>, time_hour <dttm>
flights1 <- select (flights, -month, -day, -dep_time, -sched_dep_time, -arr_time, -sched_arr_time, -arr_delay, -flight, -tailnum, -origin, -dest, -hour, -minute)
head(flights1)
# A tibble: 6 × 6
   year dep_delay carrier air_time distance time_hour          
  <int>     <dbl> <chr>      <dbl>    <dbl> <dttm>             
1  2023       203 UA           367     2500 2023-01-01 20:00:00
2  2023        78 DL           108      760 2023-01-01 23:00:00
3  2023        47 B6           190     1576 2023-01-01 23:00:00
4  2023       173 B6           108      636 2023-01-01 21:00:00
5  2023       228 UA            80      488 2023-01-01 20:00:00
6  2023         3 AA           154     1085 2023-01-01 05:00:00
ggplot(flights1, aes (x= dep_delay, y= distance)) +
  xlab("Delay Amount for Flights in Min") +
  ylab("Flight Distance in Miles") +
  theme_minimal(base_size = 12)

p1 <- ggplot(flights1, aes (x= distance, y= dep_delay, color = carrier)) +
  xlab("Delay Amount for Flights in Min") +
  ylab("Flight Distance in Miles") +
  labs(title= "Amount of time Delayed between Carriers and Distance") +
  theme_minimal(base_size = 12)

p1 + geom_point()
Warning: Removed 10738 rows containing missing values or values outside the scale range
(`geom_point()`).

This plot I have created is a simple ggplot. One aspect that I’d like to highlight is the use of the legend on the right used to view the carriers for the flights. The graph represents the number of flights and how much their flight was delayed for, as well as their flight distance. If there’s one aspect I would want to work on, it would be adding a mini heatmap as a legend.