Learn R Programming

carbonr (version 0.2.1)

airplane_emissions: Calculate CO2e emissions from an airplane journey

Description

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.

Usage

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")
)

Value

Returns CO2e emissions in tonnes.

Arguments

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".

Details

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.

Examples

Run this code
# 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")

Run the code above in your browser using DataLab