# A tibble: 6 × 2
carrier total_dep_delay
<fct> <dbl>
1 Alaska Airlines 31997
2 American Airlines 140149
3 Delta Air Lines 143104
4 Endeavor Air 219138
5 JetBlue Airways 186239
6 Midwest Airlines 419241
Data Visualization
P1 <-ggplot(Altered_Flights_Summary, aes(x = carrier, y = total_dep_delay, fill = total_dep_delay)) +geom_bar(stat ="identity") +labs(x="Airline Carriers", y ="Early Departure Minutes Accumulated", title ="Top 10 Carriers Who Left the Earliest in 2023", fill ="Minutes", caption ="Source: FAA Aircraft registry") +scale_fill_gradient(low ="cyan", high ="darkmagenta") +#scale_fill_brewer() did not worktheme(axis.text.x =element_text(angle =90))
Converting From Scientific Notation to Standard Notation
options(scipen =999)
Bargraph
P1
Essayr
I decided to have fun with the NYC Flights data set and made a bar graph that represents the top 10 carriers that left the earliest in 2023. I changed the codes of the carriers to their proper names. Then, filter the data so it only includes the flights that had early departures, as well as removing the four lowest carriers. After cleaning the data, I wanted to sort the data so the carriers with the most early departure minutes accumulated are from greatest to least. This was the most difficult part for me, but with the help of notes (from DATA 101 & 110), Geeks4Geeks, and Stack Overflow. I was able to figure it out. I had to convert the negative numbers to positive by using the abs function in the mutate. Then in the summary, I used the mutate, summarize, and factor to order the minutes from greatest to least. Finally, I put the summary into the bar graph, added the titles, converted to standard notation, and added some color. Besides that, I had a lot of fun putting together the code to create this visual.