run_information: Information for a given run

View source: R/runs.R

run_informationR Documentation

Information for a given run

Description

Run IDs are not unique across the network. If you are interested in a specific run, consider supplying a value to the optional route_type argument.

Usage

run_information(
  run_ref,
  route_type = NULL,
  include_geopath = FALSE,
  geopath_utc = NULL,
  date_utc = NULL,
  user_id = determine_user_id(),
  api_key = determine_api_key()
)

Arguments

run_ref

A character run reference. This supersedes the integer run_id. For backwards compatibility and since most run references are integers, this function will attempt to convert an the argument to a character. Run references may be retrieved from the departures or runs_on_route functions.

route_type

Optionally filter results by a route type. A route type 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.

include_geopath

Logical. Whether to populate the geopath column. Defaults to FALSE.

geopath_utc

Date, or character that can be converted to a date. The UTC date for which the geopaths are effective. Defaults to the current date. Has no effect if include_geopath = FALSE. It's uncertain how much historical or future-dated data is available.

date_utc

Date, or character that can be converted to a date. The UTC date for which the results are effective. Defaults to the current date. It's uncertain how much historical or future-dated data is available. This argument is experimental and seems to not be functioning.

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

A tibble with the following columns:

  • run_id (deprecated, use run_ref instead)

  • run_ref

  • route_id

  • route_type

  • route_type_description

  • direction_id

  • run_sequence

  • final_stop_id

  • destination_name

  • status

  • express_stop_count

  • vehicle_position

  • vehicle_descriptor

  • geopath

Examples

## Not run: 
run_information("100")
run_information("100", include_geopath = TRUE)
run_information("100", include_geopath = TRUE, geopath_utc = "2020-07-01")
run_information("100", date_utc = "2020-07-01")

## End(Not run)


ptvapi documentation built on May 29, 2024, 4:48 a.m.