airport_footprint {footprint} | R Documentation |
Calculate flight emissions based on airport code pairs
Description
A function that calculates emissions per flight based on pairs of three-letter airport codes, flight classes, and emissions metrics. Emissions are returned in kilograms of the chosen metric.
Usage
airport_footprint(departure, arrival, flightClass = "Unknown", output = "co2e")
Arguments
departure |
a character vector naming one or more three-letter IATA (International Air Transport Association) airport codes for outbound destination |
arrival |
a character vector naming one or more three-letter IATA (International Air Transport Association) airport codes for inbound destination |
flightClass |
a character vector naming one or more flight class categories. Must be of the following "Unknown" "Economy", "Economy+", "Business" or "First". If no argument is included, "Unknown" is the default and represents the average passenger. |
output |
a single character argument naming the emissions metric of the output. For metrics that include radiative forcing, one of
|
Details
Distances between airports are based on the Haversine great-circle distane formula, which assumes a spherical earth. They are calculated using the airportr
package. The carbon footprint estimates are derived from the Department for Environment, Food & Rural Affairs (UK) 2019 Greenhouse Gas Conversion Factors for Business Travel (air): https://www.gov.uk/government/publications/greenhouse-gas-reporting-conversion-factors-2019
Value
a numeric value expressed in kilograms of chosen metric
Examples
# Calculations based on individual flights
airport_footprint("LAX", "LHR")
airport_footprint("LAX", "LHR", "First")
airport_footprint("LAX", "LHR", "First", "ch4")
airport_footprint("LAX", "LHR", output = "ch4")
# Calculations based on a data frame of flights
library(dplyr)
library(tibble)
travel_data <- tribble(~name, ~from, ~to, ~class,
"Mike", "LAX", "PUS", "Economy",
"Will", "LGA", "LHR", "Economy+",
"Elle", "TYS", "TPA", "Business")
travel_data %>%
rowwise() %>%
mutate(emissions = airport_footprint(from, to,
flightClass = class,
output="co2e"))