Retrieve fare information for a journey through the given zones. Also supports journey touch on and off times, to accommodate for discounts.

fare_estimate(
  min_zone,
  max_zone,
  journey_touch_on = NULL,
  journey_touch_off = NULL,
  journey_in_free_tram_zone = FALSE,
  travelled_route_types = NULL,
  user_id = determine_user_id(),
  api_key = determine_api_key()
)

Arguments

min_zone

Integer. Minimum zone travelled through.

max_zone

Integer. Maximum zone travelled through.

journey_touch_on, journey_touch_off

POSIXct or Character. Optionally filter results to a journey time. Values to both must be provided. Characters are automatically converted to datetimes, and are assumed to be given as Melbourne time.

journey_in_free_tram_zone

Boolean. Defaults to FALSE.

travelled_route_types

Integer or character vector. Optionally filter by a vector of route types. 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.

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 data frame consisting of one row for each passenger_type, and the following columns:

  • min_zone

  • max_zone

  • unique_zones

  • early_bird

  • free_tram_zone

  • weekend_journey

  • passenger_type

  • fare_2_hour_peak

  • fare_2_hour_off_peak

  • fare_daily_peak

  • fare_daily_off_peak

  • pass_7_days

  • pass_28_to_69_day_per_day

  • pass_70_plus_day_per_day

  • weekend_cap

  • holiday_cap

Examples

if (FALSE) { fare_estimate(min_zone = 1, max_zone = 2) fare_estimate(min_zone = 1, max_zone = 1, journey_in_free_tram_zone = TRUE) fare_estimate( min_zone = 1, max_zone = 2, travelled_route_types = c("Train", "Tram") ) fare_estimate( min_zone = 1, max_zone = 2, journey_touch_on = "2020-06-21 07:31:00", journey_touch_off = "2020-06-21 08:45:00" ) }