View source: R/rail_emissions.R
rail_emissions | R Documentation |
A function that calculates CO2e emissions between train stations in the UK.
rail_emissions(
from,
to,
via = NULL,
num_people = 1,
times_journey = 1,
include_WTT = TRUE,
round_trip = FALSE
)
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 |
round_trip |
Whether the journey is one-way or return. |
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.
Returns CO2e emissions in tonnes for the train journey.
# 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"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.