Theadways: To get headways and train arrive times for a given...

Description Usage Arguments Value Examples

Description

To get headways and train arrive times for a given station/route/direction in a certain time window.. Returns a list of headways at an origin station during a particular time period on a particular route.

Usage

1
2
3
Theadways(from_stop_id, to_stop_id = NULL, route_id = NULL,
  direction_id = NULL, from_datetime = (Sys.time() - 1800),
  to_datetime = Sys.time(), api_key)

Arguments

from_stop_id

GTFS-compatible stop_id for the origin stop for which headways should be returned.

to_stop_id

GTFS-compatible stop_id for the destination stop for which headways should be returned. If empty will use departures from origin stop with any destination stop on that route (i.e. not distinguishing between branches).

route_id

GTFS-compatible route_id value for which headways should be returned. If this is not included, headways for all routes between the from and to stop will be provided.

direction_id

Direction of travel for headways to be returned. If empty, will rely on

from_datetime

The start of the time period that the headways (arrival time at the origin stop) should fall within; converts to epoch time.

to_datetime

The end of the time period that the headways (arrival time at the origin stop) should fall within; converts to epoch time.

api_key

API key for MBTA Performance API. To obtain one, visit the MBTA Developer Portal (https://mbta.com/developers/mbta-performance/)

Value

Arrival times for vehicles at the particular origin stop during the time window requested.

route_id

GTFS-compatible route identifier for which headways are returned.

direction

Direction id (0/1) for which headways are returned.

current_dep_dt

Next departure time from origin stop during the time window specified.

previous_dep_dt

Previous departure time at destination stop during the time window specified.

headway_time_sec

Actual headway for next arriving vehicle during time window specified, in seconds.

benchmark_headway_time_sec

Benchmark headway for each trip, in seconds.

threshold_01_flag

Binary variable for whether a given headway was above the first threshold for delayed headways.

threshold_02_flag

Binary variable for whether a given headway was above the second threshold for delayed headways.

threshold_03_flag

Binary variable for whether a given headway was above the third threshold for delayed headways.

Examples

1
2
3
4
5
6
7
8
Theadways(from_stop_id = 70007, # Jackson Square Northbound
to_stop_id = 70034, # Malden Southbound
route_id = NULL,
direction_id = 1, # northbound
from_datetime = as.POSIXct("2015-08-03 00:00"),
to_datetime = as.POSIXct("2015-08-03 23:59"),
api_key = "wX9NwuHnZU2ToO7GmGR9uw")
#'

MBTAr documentation built on May 2, 2019, 6:59 a.m.

Related to Theadways in MBTAr...