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:
Translate a case-insensitive description such as "Tram" or "Train" to the corresponding route type code
Check a given integer to see if it is a valid route type code, returning it if so and erroring otherwise
Return NULL on NULL input
This function is not vectorised.
translate_route_type(
route_type,
user_id = determine_user_id(),
api_key = determine_api_key()
)
An integer route type code, or NULL if the input is NULL
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.
Integer or character. A user ID or devid provided by Public
Transport Victoria. Refer to ?ptvapi
for more details.
Character. An API key, with dashes, provided by Public
Transport Victoria. Refer to ?ptvapi
for more details.