fare_estimate: Calculate a fare estimate between zones

Description Usage Arguments Value Examples

View source: R/fare-estimate.R

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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:

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## Not run: 
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"
 )

## End(Not run)

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