Download Air Travel Data for Specified Years and Airports
Supplies a set of functions to query air travel data for user-
specified years and airports. Datasets include on-time flights, airlines,
airports, and weather.
anyflights supplies a set of functions to query air travel data. With a user-defined year and airport, the
anyflights function will grab data on:
flights: all flights that departed a given airport in a given year
weather: hourly meterological data for a given airport in a given year
airports: airport names and locations
airlines: translation between two letter carrier codes and names
The package also includes a set of functions to query each of the above datasets individually. Each of the functions are named
get_ followed with the names of the datasets (shown above in
code), and require a varying combination of the
station (i.e. airport code),
year (as an integer), and
dir (folder in the working directory to save to) arguments.
The main intent of this package, among others, is to allow for students learning the basics of R and the tidyverse through labs working with the
nycflights13 package to work with more recent data from their own hometowns or from the airport closest to their school. An instructor can use this package to generate a folder of data (~5MB) that can be distributed to students through Dropbox, GitHub, etc. As a result, students can make discoveries that could impact their own, real-life air travel decisions. (I was introduced to R through a guided analysis of the
nycflights13 data, and have since longed to create this package for this reason.)
This package is inspired by and derived from Hadley Wickham's nycflights13. However, note that the
planes dataset is not included in the downloads for now, as the source for the
planes dataset changes the formatting of the files nearly every year. A (now-deprecated) function
get_planes is in the R folder, but is not exported in the build. This function may be available in later versions.
These functions require a strong connection to run; expect several minutes of runtime, especially for the
For now, years 2015 and on are supported. The FAA usually posts all of the data for a given year during February or March of the following year. All airports with an FAA LID code are supported, to my knowledge.
You can install the latest version of
anyflights with the following code.
# install.packages("devtools") # library(devtools) devtools::install_github("simonpcouch/anyflights")
Simon P. Couch
Functions in anyflights
|get_airlines||Generate an airlines dataset|
|get_airports||Generate an airports dataset|
|get_flights||Generate a flights dataset for a specified year and airport|
|get_weather||Generate a weather dataset for the specified year and airport|
|anyflights||Generate a folder of air travel datasets for a given year and airport|
Last month downloads
|Packaged||2018-07-31 15:23:40 UTC; simonpcouch|
|Date/Publication||2018-07-31 16:10:03 UTC|
Include our badge in your README