Returns next bus arrival times at a stop.

next_bus(StopID, api_key = wmata_key())

Format

A tibble 1 row per arrival with 8 variables:

StopID

7-digit regional ID which can be used in various bus-related methods. If unavailable, the StopID will be 0 or NA

StopName

Stop name. May be slightly different from what is spoken or displayed in the bus.

RouteID

Base route name as shown on the bus. This can be used in other bus-related methods. Note that all variants will be shown as their base route names (i.e.: 10Av1 and 10Av2 will be shown as 10A).

DirectionText

Customer-friendly description of direction and destination for a bus.

DirectionNum

Denotes a binary direction (0 or 1) of the bus. There is no specific mapping to direction, but a different value for the same route signifies that the buses are traveling in opposite directions. Use the DirectionText element to show the actual destination of the bus.

Minutes

Minutes until bus arrival at this stop. Numeric value.

VehicleID

Bus identifier. This can be correlated with results returned from bus positions.

TripID

Trip identifier. This can be correlated with the data in our bus schedule information as well as bus positions.

Arguments

StopID

7-digit regional stop ID.

api_key

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

Value

Data frame of bus arrivals.

Examples

if (FALSE) {
next_bus(StopID = "1001195")
}