next_train | R Documentation |
Returns next train arrival information for one or more stations. Will return
an empty set of results when no predictions are available. Use "All" for the
StationCodes
parameter to return predictions for all stations.
next_train(StationCodes = NULL, api_key = wmata_key())
StationCodes |
Character vector of station codes. For all predictions,
use |
api_key |
Subscription key which provides access to this API. Defaults
|
A tibble 1 row per arrival with 9 variables:
Number of cars on a train, usually 6 or 8, but might also NA
.
Abbreviated version of the final destination for a train. This is similar to what is displayed on the signs at stations.
Destination station code. Can be NA
. Use this
value in other rail-related APIs to retrieve data about a station.
When DestinationCode
is populated, this is the
full name of the destination station, as shown on the WMATA website.
Denotes the track this train is on, but does not necessarily equate to Track 1 or Track 2. With the exception of terminal stations, predictions at the same station with different Group values refer to trains on different tracks.
Two-letter abbreviation for the line (e.g.: RD, BL, YL, OR, GR,
or SV). May also be NA
for trains with no passengers.
Station code for where the train is arriving. Useful
when passing in All as the StationCodes
parameter. Use this value in
other rail-related APIs to retrieve data about a station.
Full name of the station where the train is arriving.
Useful when passing in "All" as the StationCodes
parameter.
Minutes until arrival. Can be a numeric value, 0 (arriving),
-1 (boarding), or NA
.
For terminal stations (e.g.: Greenbelt, Shady Grove, etc.), predictions may be displayed twice.
Some stations have two platforms (e.g.: Gallery Place, Fort Totten, L'Enfant Plaza, and Metro Center). To retrieve complete predictions for these stations, be sure to pass in both StationCodes.
For trains with no passengers, the DestinationName
will be "No Passenger".
Data frame of train arrivals.
Other Real-Time Predictions:
next_bus()
## Not run:
next_train(StationCodes = c("A02", "B02"))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.