flight_summary <- flights %>%group_by(carrier) %>%summarize(avg_delay =mean(dep_delay, na.rm =TRUE),total_flights =n())flight_plot <-ggplot(flight_summary, aes(x = carrier, y = avg_delay, fill = total_flights)) +geom_bar(stat ="identity", color ="black") +labs(x ="Airlines by Carrier", y ="Average Flight Delay in Minutes", title ="Average Flight Delay by Carrier \nCompared to Total Number of Flights") +scale_fill_gradient(low ="yellow", high ="darkred", name ="Total Number of Flights")flight_plot
I chose to make a bar graph showing the average flight delay per airline compared with the total number of flights per airline. I originally wanted to show the average delay by tail number but the vizual was too clustered and not effective. One thing to highlight from the graph is that there is no relation between total flights and average delay. This is shown by F9 having less than 700 total flights but yet having a higher average flight delay than EV, an airline with more than 54,000 flights.