get_bus_location: get_bus_location

Description Usage Arguments Details Value Examples

View source: R/get_bus_location.R

Description

get_bus_location() fetches the last location and status for buses currently running.

Usage

1
2
get_bus_location(routes = NULL, vehicle_ids = NULL,
  time_resolution = "s", key = Sys.getenv("ctar_api_key"))

Arguments

routes

A vector of bus routes to query, such as c(8, 12, 49). API limits to 10 at a time.

vehicle_ids

A vector of bus routes to query, such as c(4008, 4012, 8049). API limits to 10 at a time.

time_resolution

Determines whether to round the last timestamp up to the minute or not. Default "s" uses second level data. Can supply "m" to round up to minute.

key

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

Details

The Bus Tracker API allows you to query by the ID of the bus, e.g. 4008, or by the route, e.g. 49.

Value

Returns a dataframe of individual bus statuses and last postition as of the API server time in CDT TZ.

Examples

1
2
3
4
## Not run: 
get_bus_location(routes=c(8, 12, 49), key = Sys.getenv("ctar_api_key"))

## End(Not run)

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