rail_times: Rail Station Timings

View source: R/rail-times.R

rail_timesR Documentation

Rail Station Timings

Description

Returns opening and scheduled first/last train times based on a given StationCode. Omit the StationCode to return timing information for all stations.

Usage

rail_times(StationCode = NULL, api_key = wmata_key())

Arguments

StationCode

Station code. Use the rail_stations() function to return a list of all station codes. Use NULL (default) to return times for all stations.

api_key

Subscription key which provides access to this API. Defaults Sys.getenv("WMATA_KEY") via wmata_key().

Format

A tibble 1 row per train with 8 variables:

StationCode

Station code for this station. Use this value in other rail-related APIs to retrieve data about a station.

StationName

Full name of the station.

DestinationStation

Station code for the train's destination. Use this value in other rail-related APIs to retrieve data about a station.

Weekday

Day of the week abbreviation. From list element names.

OpeningTime

Station opening time. Converted to hms class with hms::parse_hm(), representing seconds since midnight of that Weekday.

FirstTime

First train leaves the station at this time (ET). Converted to hms class with hms::parse_hm(), representing seconds since midnight of that Weekday.

LastTime

Last train leaves the station at this time (ET). Converted to hms class with hms::parse_hm(), representing seconds since midnight of that Weekday. For times that were in the AM of the next Weekday, time is greater than 24 hours.

Details

Note that for stations with multiple platforms (e.g.: Metro Center, L'Enfant Plaza, etc.), a distinct call is required for each StationCode to retrieve the full set of train times at such stations.

Value

A tidy data frame of station schedules. Combined from a nested list of weekday times.

See Also

https://developer.wmata.com/docs/services/5476364f031f590f38092507/operations/5476364f031f5909e4fe3312

Other Rail Station Information: rail_destination(), rail_entrance(), rail_lines(), rail_path(), rail_stations(), station_info()

Examples

## Not run: 
rail_times("A01")

## End(Not run)

metro documentation built on Nov. 2, 2023, 6:06 p.m.