Delay_Histogram <- AA_Delays_In2013 %>%ggplot() +geom_histogram(mapping =aes(x = month, y = dep_delay, fill = month, color ="red"),position ="identity", stat ="identity") +labs(fill ="Month",y ="Frequency of Delays",title ="Histogram of American Airlines Delays",caption ="All data comes from the NYCFlights dataset")
Warning in geom_histogram(mapping = aes(x = month, y = dep_delay, fill = month,
: Ignoring unknown parameters: `binwidth`, `bins`, and `pad`
Delay_Histogram
My data visualization is a histogram that displays the highlights the frequency of delays and what months they occur in. All data was collected using the flights package in the NYCFlights13 dataset. What I tried to do was I used filter to filter only the flights from American Airlines, in 2013, that had a departure delay. By using the dep_delay, year, and carrier functions I was able to do this. I then used ggplot to create a histogram that displayed the months and the amount of flights per month that had delays. I also included a legend with labels to help clearly display the colors and what months go with which colors. I also used the lab function to label the two axis, the visualization’s title, and the caption. Finally, I used fill to color in the bars and I used color to create the colored outlines around the bars.