Load Packages and Data

# Load necessary packages
library(ggplot2)
library(dplyr)
library(nycflights13)

# Load flights data set in nycflights
data(flights)

LC

What do positive values of the gain variable in flights_plus correspond to? What about negative values? And what about a zero value?

flights_plus <- flights %>% 
  mutate(gain = arr_delay - dep_delay)

Solution

ggplot(data=flights_plus, aes(x=gain)) +
  geom_histogram()