anyflights (version 0.1.0)

get_flights: Generate a flights dataset for a specified year and airport

Description

Please note that, even with a strong internet connection, this function may take several minutes to download relevant data, and temporarily requires up to 2GB of storage (the file size is trimmed down significantly after some post-processing---to the order of a couple MB---and the larger files are deleted before termination)

Usage

get_flights(station, year, dir)

Arguments

station

A character string---the airport of interest (use the FAA LID airport code).

year

The year of interest, as an integer (unquoted). Currently, years 2015 and on are supported. Information for the most recent year is usually available by February or March in the following year.

dir

A character string--the folder for the dataset to be saved in

Value

A data frame with ~10k-500k rows and 19 variables:

year,month,day

Date of departure

dep_time,arr_time

Actual departure and arrival times, local tz.

sched_dep_time,sched_arr_time

Scheduled departure and arrival times, local tz.

dep_delay,arr_delay

Departure and arrival delays, in minutes. Negative times represent early departures/arrivals.

hour,minute

Time of scheduled departure broken into hour and minutes.

carrier

Two letter carrier abbreviation. See get_airlines to get name

tailnum

Plane tail number

flight

Flight number

origin,dest

Origin and destination. See get_airports for additional metadata.

air_time

Amount of time spent in the air, in minutes

distance

Distance between airports, in miles

time_hour

Scheduled date and hour of the flight as a POSIXct date. Along with origin, can be used to join flights data to weather data.

See Also

get_airports for airport data, get_weather for weather data, get_airlines for airline data, and anyflights for a wrapper function

Examples

Run this code
# NOT RUN {
get_flights(station = "MCI", year = 2016, dir = tempdir())
# }

Run the code above in your browser using DataCamp Workspace