View source: R/filter_by_stop_id.R
filter_by_stop_id | R Documentation |
stop_id
Filters a GTFS object by stop_id
s, keeping (or dropping) relevant entries
in each file.
filter_by_stop_id(
gtfs,
stop_id,
keep = TRUE,
include_children = TRUE,
include_parents = keep,
full_trips = TRUE
)
gtfs |
A GTFS object, as created by |
stop_id |
A character vector. The |
keep |
A logical. Whether the entries related to the |
include_children |
A logical. Whether the filtered output should
keep/drop children stops of those specified in |
include_parents |
A logical. Whether the filtered output should
keep/drop parent stations of those specified in |
full_trips |
A logical. Whether to keep all stops that compose trips
that pass through the stops specified in |
The GTFS object passed to the gtfs
parameter, after the filtering
process.
Other filtering functions:
filter_by_agency_id()
,
filter_by_route_id()
,
filter_by_route_type()
,
filter_by_service_id()
,
filter_by_sf()
,
filter_by_shape_id()
,
filter_by_spatial_extent()
,
filter_by_time_of_day()
,
filter_by_trip_id()
,
filter_by_weekday()
data_path <- system.file("extdata/spo_gtfs.zip", package = "gtfstools")
gtfs <- read_gtfs(data_path)
stop_ids <- c("18848", "940004157")
object.size(gtfs)
# keeps entries related to trips that pass through specified stop_ids
smaller_gtfs <- filter_by_stop_id(gtfs, stop_ids, full_trips = FALSE)
object.size(smaller_gtfs)
# drops entries related to trips that pass through specified stop_ids
smaller_gtfs <- filter_by_stop_id(
gtfs,
stop_ids,
keep = FALSE,
full_trips = FALSE
)
object.size(smaller_gtfs)
# the old behavior of filtering trips that contained the specified stops has
# been deprecated
invisible(filter_by_stop_id(gtfs, stop_ids, full_trips = TRUE))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.