Alaska Flights

Load Alaska Flights data:

library(ggplot2)
library(dplyr)
library(nycflights13)
library(knitr)
data(flights)

# Load Alaska data, deleting rows that have missing dep or arr data
alaska_flights <- flights %>% 
  filter(carrier == "AS") %>% 
  filter(!is.na(dep_delay) & !is.na(arr_delay))

# Instead of looking at all 709 Alaska flights, let's look at a random sample
# of 10 of them:
set.seed(76)
alaska_flights_sample <- alaska_flights %>% 
  sample_n(10)

# Plot the 25 pairs of points and regression line:
ggplot(data=alaska_flights_sample, aes(x = dep_delay, y = arr_delay)) + 
  geom_point() +
  geom_smooth(method="lm", se=FALSE)