View source: R/airplane_emissions.R
airplane_emissions | R Documentation |
This function calculates the CO2e emissions between airports based on the provided parameters. The distances are calculated using the "airport_distance" function from the "airportr" package.
airplane_emissions(
from,
to,
via = NULL,
num_people = 1,
radiative_force = TRUE,
include_WTT = TRUE,
round_trip = FALSE,
class = c("Average passenger", "Economy class", "Business class",
"Premium economy class", "First class")
)
from |
Three-letter IATA code corresponding to the departure airport. You can check the IATA code using the "airport_finder" function. |
to |
Three-letter IATA code corresponding to the destination airport. You can check the IATA code using the "airport_finder" function. |
via |
Optional. Vector of three-letter IATA codes corresponding to airports for any layovers or stops along the route. |
num_people |
Number of people taking the flight. Must be a single numerical value. |
radiative_force |
Logical. Determines whether radiative forcing should be taken into account. It is recommended to set this parameter as TRUE since emissions from airplanes at higher altitudes have a greater impact on climate change than those at ground level. |
include_WTT |
Logical. Determines whether emissions associated with extracting, refining, and transporting fuels should be included. It is recommended to set this parameter as TRUE. |
round_trip |
Logical. Determines if the flight is round trip (return) or one-way. Default is FALSE (one-way). |
class |
Class flown in. Options include "Average passenger", "Economy class", "Business class", "Premium economy class", and "First class". |
The distances are calculated using the "airport_distance" function from the "airportr" package. This means that the distances between locations uses the Haversine formula. This is calculated as the crow flies.
Returns CO2e emissions in tonnes.
# Calculate emissions for a flight between Vancouver (YVR) and Toronto (YYZ)
airplane_emissions("YVR", "YYZ")
# Calculate emissions for a flight between London Heathrow (LHR)
# and Kisumu Airport (KIS), with layovers in Amsterdam (AMS) and Nairobi
# (NBO), flying in Economy class.
airplane_emissions("LHR", "KIS", via = c("AMS", "NBO"),
class = "Economy class")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.