| get_stops | R Documentation |
Returns the stops visited by the given trips and/or routes.
get_stops(gtfs, trip_id = NULL, route_id = NULL)
gtfs |
A GTFS object, as created by |
trip_id |
A character vector including the |
route_id |
A character vector including the |
A data.table with the entries of the stops table that are
visited by the selected trips, with all its columns and in its original
order.
A trip is selected if it is listed in trip_id (when given) and belongs to
one of the routes listed in route_id (when given), so when both are given
only the trips that satisfy both are selected. When route_id is given,
trips not listed in the trips table can't be matched to a route and are
not selected. Ids not found in the feed raise a warning.
Only the stops listed in the stop_times entries of the selected trips are
returned, so their parent stations, entrances, etc. are not. Please use
get_parent_station() and get_children_stops() to get these. Stops listed
in stop_times but not in stops are not returned.
get_parent_station(), get_children_stops(),
filter_by_trip_id(), filter_by_route_id()
data_path <- system.file("extdata/spo_gtfs.zip", package = "gtfstools")
gtfs <- read_gtfs(data_path)
# stops visited by a trip
stops <- get_stops(gtfs, trip_id = "CPTM L07-0")
head(stops)
# stops visited by the trips of a route
stops <- get_stops(gtfs, route_id = "CPTM L07")
head(stops)
# stops visited by any trip
stops <- get_stops(gtfs)
nrow(stops)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.