Week 5 Assignment 5A Approach - Airline Delays

Author

Supriya P.

Introduction (Approach)

For this assignment, I will recreate the airline arrival table as a CSV that keeps its original wide layout, with the five cities as columns and a row for on-time and delayed flights under each airline. In the original table, the airline name only appears on the on-time row, so the delayed rows have blank cells. I plan to fill those in after loading the data into R, and then reshape the city columns into rows so that each row represents one airline, city, and flight status.

Once the data is in long format, I will calculate the percentage of delayed flights for each airline, first across all cities combined and then city by city. Looking at the raw numbers, the two airlines have very different flight volumes in each city. AM West flies far more into Phoenix, while Alaska flies far more into Seattle. Because of this, I expect the overall comparison and the city by city comparison may not point to the same airline, which would be an example of Simpson’s paradox. If that happens, I will look at how each airline’s flights are distributed across cities to explain the difference.

Before coding, I plan to work through the totals and percentages in a spreadsheet so I know what results to expect and can check my R output against them.