get_transit: Winnipeg Transit API

Description Usage Arguments Value Examples

View source: R/get_transit.R

Description

The get_transit function reads in the Winnipeg Transit JSON data the [Winnipeg Transit API v3](https://api.winnipegtransit.com/home/api/v3) and flattens it into a tidy format. The API requires users to register for an API key.

Usage

1
2
3
4
5
6
7
8
get_transit(
  option_vec = NA,
  stop = NA,
  route = NA,
  type = "stops",
  api_key = NA,
  ...
)

Arguments

option_vec

Optional vector of options for API call. See (https://api.winnipegtransit.com/home/api/v3) for relevant options.

stop

Required stop parameter for "stop-features" or "schedule" requests.

route

Required route parameter for route "variants" requests. See (https://api.winnipegtransit.com/home/api/v3/services/variants) for possible values.

type

Specifies with data set to download. Currently supports "stops", "locations", "service-advisories", "routes", "streets", "system-messages", "trip-planner", "stop-features", "schedule", "statuses", "variants".

api_key

Manditory api parameter for users with a city of Winnipeg Transit API account available at (https://api.winnipegtransit.com/home/api/v3)

...

Additional parameters to pass to the Winnipeg Transit API.

Value

A dataframe containing the relvant data set.

Examples

1
2
3
4
5
6
7
## Not run: 
get_transit(option_vec = c("lat=49.8951",
            "lon=-97.1384", "distance=1000",
            "walking=true", "usage=short"),
             api_key = transit_API)

## End(Not run)

jdallmann/winnipegr documentation built on Jan. 20, 2020, 2:05 a.m.