Skip to contents

Pulls CODA/CFMU punctuality counts for a set of airports and years using a dbplyr translation of the legacy SQL embedded in 02-chn-eur-data-prep.Rmd. Flights are bucketed by departure/arrival delay (<=15 minutes vs >15) and grouped by month and airport pairing with TOP34 flags.

Usage

pbwg_otp_punctuality(years, airports, conn = NULL)

Arguments

years

Integer vector of years (Gregorian) to retrieve.

airports

Character vector of ICAO airport designators used for the TOP34 flag as well as the explicit airport columns in the result.

conn

Optional Oracle DBI::DBIConnection. When omitted a fresh PRU_DEV connection is created via eurocontrol::db_connection().

Value

A tibble with an attached "sql" attribute (named vector of one SQL string per requested year) and columns:

  • YYYear truncated date (first day of the year).

  • MMMonth truncated date (first day of the month).

  • ADEPDeparture airport code; non-target airports grouped as "OTH".

  • ADESDestination airport code; non-target airports grouped as "OTH".

  • FROM_TOP34"Y"/"N" flag if the departure airport is in the target set.

  • TO_TOP34"Y"/"N" flag if the destination airport is in the target set.

  • TOP34"Y" when either leg is in the target set, otherwise "N".

  • PCT_DEPDeparture punctuality bucket (<=15 or >15).

  • PCT_ARRArrival punctuality bucket (<=15 or >15).

  • N_CODANumber of CODA records in the bucket.

  • N_CFMUNumber of CFMU records in the bucket.

  • YEARNumeric year indicator matching the query year.