flightsbr is an R package to download flight and airport data from Brazil’s Civil Aviation Agency (ANAC). The package currently includes five main functions:
read_flights()read_airports()read_aircraft()read_airport_movements()read_airfares()read_flights():Flights data include detailed information on every international flight to and from Brazil, as well as domestic flights within the country. The data include flight-level information of airports of origin and destination, flight duration, aircraft type, payload, and the number of passengers, as well as several other variables. - Data dictionary for flights.
read_airports():Airports data covers all airports and aerodromes registered in Brazil’s Civil Aviation Agency (ANAC). It includes detailed information on ICAO code, municipality, geographical coordinates, runway dimensions etc.
read_aircraft():All aircraft registered in the Brazilian Aeronautical Registry (Registro Aeronáutico Brasileiro - RAB), organized by the Brazilian Civil Aviation Agency (ANAC). - Data dictionary for aircraft data.
read_airport_movements():The data covers all passenger, aircraft, cargo and mail movement from airports regulated by ANAC. - Data dictionary for airport movements data.
read_airfares():The data covers airfares of domestic and international flights.
Before using flightsbr please make sure that you have it installed on your computer. You can download the most stable version from CRAN.
Now we can load the library and start downloading data.
flightsbr saves the files it downloads from ANAC in
a cache folder on your computer. Each file is downloaded only once, even
across R sessions: later calls read the local copy, and a file is
downloaded again only if ANAC’s copy has changed size, or if you set
cache = FALSE.
You can check, change, list and delete the cached data with four functions:
# where are the cached files?
get_flightsbr_cache_dir()
# use another folder (this choice is kept across R sessions)
set_flightsbr_cache_dir("path/to/folder")
# go back to the default folder
set_flightsbr_cache_dir(NULL)
# list the cached files
list_flightsbr_cache()
# delete one cached file, or all of them
delete_flightsbr_cache("basica2015-06.zip")
delete_flightsbr_cache()