This function generates a list of dataframes similar to those found in the nycflights13 data package for any US airports and time frames. Please note that, even with a strong internet connection, this function may take several minutes to download relevant data.

anyflights(station, year, month = 1:12, dir = NULL)



A character vector giving the origin US airports of interest (as the FAA LID airport code).


A numeric giving the year of interest. This argument is currently not vectorized, as dataset sizes for single years are significantly large. Information for the most recent year is usually available by February or March in the following year.


A numeric giving the month(s) of interest.


An optional character string giving the directory to save datasets in. By default, datasets will not be saved to file.


A list of dataframes (and, optionally, a directory of datasets) similar to those found in the nycflights13 data package.


The anyflights() function is a wrapper around the following functions:

  • get_airlines: Grab data to translate between two letter carrier codes and names

  • get_airports: Grab data on airport names and locations

  • get_flights: Grab data on all flights that departed given US airports in a given year and month

  • get_planes: Grab construction information about each plane

  • get_weather: Grab hourly meterological data for a given airport in a given year and month

The recommended approach to download data for many stations (airports) is to supply a vector of stations to the station argument rather than iterating over many calls to anyflights(). The faa column in dataframes outputted by get_airports() provides the FAA LID codes for all supported airports. See ?get_flights for more details on implementation.

See also

get_flights for flight data, get_weather for weather data, get_airlines for airlines data, get_airports for airports data, or get_planes for planes data.

Use the as_flights_package function to convert the output of this function to a data-only package.


# grab data on all flights departing from 
# Portland International Airport in June 2019 and 
# other useful metadata without saving to file
if (FALSE) anyflights("PDX", 2018, 6)

# ...or, grab that same data and opt to save the 
# file as well! (tempdir() can usually be specified 
# as a character string giving the path to a folder)
if (FALSE) anyflights("PDX", 2018, 6, tempdir())