Learn R Programming

ptvapi (version 2.0.5)

all_disruptions_to_tibble: Convert the contents of a disruptions API call to a single tibble

Description

Disruptions API responses contain an element for every service type, eg. metro train, taxis, Skybus. Normally we would map-reduce the content of an API call with a function analogous to disruption_to_tibble. But because of the extra layer of nesting in the response, we have to map-reduce the service types first.

Usage

all_disruptions_to_tibble(disruptions_content)

Value

A tibble with the following columns:

  • disruption_mode

  • disruption_mode_description

  • disruption_id

  • title

  • url

  • description

  • disruption_status

  • disruption_type

  • published_on

  • last_updated

  • from_date

  • to_date

  • routes

  • stops

  • colour

  • display_on_board

  • display_status

Arguments

disruptions_content

The raw disruptions content returned by the disruptions API call.

Details

Note that we return an empty tibble if there are no disruptions, so that this situation is omitted.