get_train_position: get_train_position

Description Usage Arguments Details Value Examples

View source: R/get_train_position.R

Description

This function is one of two that interacts with the Follow the Train API. It provides the location of a single train by its run number.

Usage

1
get_train_position(run_number = NULL, key = Sys.getenv("ctar_api_key"))

Arguments

run_number

This is a run number associated with a single train. These change daily. 'get_arrivals()' or 'get_locations()' will provide info on run number.

key

The Chicago Transit Authority developer API key either entered as a string or saved to the environment object 'ctar_api_key'

Details

This API tends to be finicky and fail. The 'get_arrivals()' function tends to be more precise and can be filtered by run number.

Value

Returns a table of the longitude and latitude of a single train.

Examples

1
2
3
4
## Not run: 
get_train_position(308, key = Sys.getenv("ctar_api_key"))

## End(Not run)

willdebras/ctar documentation built on Nov. 5, 2019, 12:20 p.m.