Learn R Programming

carbonr (version 0.2.1)

rail_emissions: Calculate CO2e emissions from a train journey

Description

A function that calculates CO2e emissions between train stations in the UK.

Usage

rail_emissions(
  from,
  to,
  via = NULL,
  num_people = 1,
  times_journey = 1,
  include_WTT = TRUE,
  round_trip = FALSE
)

Value

Returns CO2e emissions in tonnes for the train journey.

Arguments

from

Station departing from.

to

Station arriving to

via

Optional. Takes a vector containing the stations the train travels via.

num_people

Number of people taking the journey. Takes a single numerical value.

times_journey

Number of times the journey is taken.

include_WTT

logical. Recommended TRUE. Whether to include emissions associated with extracting, refining, and transporting fuels.

round_trip

Whether the journey is one-way or return.

Details

The distances are calculated using the Haversine formula. This is calculated as the crow flies. As a result, inputting the "via" journeys will make for a more reliable function.

Examples

Run this code
# Emissions for a train journey between Southampton Central and
# Manchester Piccadilly Station
rail_emissions("Southampton Central", "Manchester Piccadilly")

# Emissions for a train journey between Bristol Temple Meads and
# London Paddington via Bath, Swindon, and Reading
# Use the \code{rail_finder} function to find the name of London Paddington
rail_finder(region = "London")
# Then calculate emissions
rail_emissions("Bristol Temple Meads", "Paddington", via = c("Bath Spa",
"Swindon", "Reading"))

Run the code above in your browser using DataLab