translate_route_type: Translate a route type input into a numerical route type

Description Usage Arguments Value

View source: R/route-types.R

Description

Many API calls require a route type (eg. "Tram" or "Train"). These must be provided as integers, which are translated to route type descriptions with the 'route_types() function/API call. This function will:

This function is not vectorised.

Usage

1
2
3
4
5
translate_route_type(
  route_type,
  user_id = determine_user_id(),
  api_key = determine_api_key()
)

Arguments

route_type

A route type which can be provided either as a non-negative integer code, or as a character: "Tram", "Train", "Bus", "Vline" or "Night Bus". Character inputs are not case-sensitive. Use the route_types function to extract a vector of all route types.

user_id

Integer or character. A user ID or devid provided by Public Transport Victoria. Refer to ?ptvapi for more details.

api_key

Character. An API key, with dashes, provided by Public Transport Victoria. Refer to ?ptvapi for more details.

Value

An integer route type code, or NULL if the input is NULL


ptvapi documentation built on May 2, 2021, 9:06 a.m.