This function will search outlets in which the search term can be found in either the outlet name, outlet business or outlet suburb. The search is case-insensitive. The search term must contain at least 3 characters, and cannot be numeric.

search_outlets(
  search_term,
  latitude = NULL,
  longitude = NULL,
  max_distance = NULL,
  route_types = NULL,
  user_id = determine_user_id(),
  api_key = determine_api_key()
)

Arguments

search_term

Character. Term used to perform search.

latitude

Numeric. Latitude in decimal degrees. For example, Flinders Street Station is at approximately -37.8183 latitude.

longitude

Numeric. Longitude in decimal degrees. For example, Flinders Street Station is at approximately 144.9671 longitude.

max_distance

Integer. Optionally filter by maximum distance from the given location, in metres.

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 tibble with the following columns:

  • outlet_slid_spid

  • outlet_name

  • outlet_business

  • outlet_latitude

  • outlet_longitude

  • outlet_suburb

  • outlet_postcode

  • outlet_business_hour_mon

  • outlet_business_hour_tue

  • outlet_business_hour_wed

  • outlet_business_hour_thu

  • outlet_business_hour_fri

  • outlet_business_hour_sat

  • outlet_business_hour_sun

  • outlet_notes

Examples

if (FALSE) { search_outlets("St Kilda") search_outlets("St Kilda", route_types = c("Train", "Tram")) search_outlets("St Kilda", route_types = 1) search_outlets( "St Kilda", latitude = -37.867647, longitude = 144.976809 ) search_outlets( "St Kilda", latitude = -37.867647, longitude = 144.976809, max_distance = 100 ) }