Learn R Programming

carbonr (version 0.2.1)

rail_finder: Find the station code for a train station

Description

Find the name, area, and code of a train station in the UK. For use in the rail_emissions function.

Usage

rail_finder(
  station,
  region,
  county,
  district,
  station_code,
  distance = 0.1,
  ignore.case = FALSE
)

Value

Data frame containing the station code, station name, region, county, district, latitude, and longitude of a train station in the UK.

Arguments

station

Name of train station.

region

Region the train station is in. One of c("London", "Scotland", "Wales - Cymru", "North West", "West Midlands", "North East", "East", "South East", "East Midlands", "Yorkshire And The Humber", "South West", NA).

county

County the train station is in.

district

District the train station is in.

station_code

Code of the train station.

distance

Maximum distance allowed for a match between the name/country/city given, and that of the value in the data set.

ignore.case

If FALSE, the check for is case-sensitive. If TRUE, case is ignored.

Examples

Run this code
# Can get the station code from the station. Gets similar matches.
rail_finder(station = "Bristo")

# Can get the code from the station and city.
rail_finder(station = "Bristo", county = "Bristol")

# Can find the name and district of a train station given the IATA code
rail_finder(station_code = "BRI")

Run the code above in your browser using DataLab