Filters a GTFS object by
stop_ids, keeping (or dropping) relevant entries
in each file. In order to keep the integrity of trips as described in the
stop_times table, the
stop_ids are actually used to filter
which are then used to filter the rest of the GTFS object.
filter_by_stop_id(gtfs, stop_id, keep = TRUE)
A GTFS object, as created by
A character vector. The
stop_ids used to filter the data.
A logical. Whether the entries related to the
passes through the specified
stop_ids should be kept or dropped (defaults
TRUE, which keeps the entries).
The GTFS object passed to the
gtfs parameter, after the filtering
Other filtering functions:
data_path <- system.file("extdata/spo_gtfs.zip", package = "gtfstools") gtfs <- read_gtfs(data_path) stop_ids <- c("18848", "940004157") object.size(gtfs) #> 811304 bytes # keeps entries related to trips that pass through specified stop_ids smaller_gtfs <- filter_by_stop_id(gtfs, stop_ids) object.size(smaller_gtfs) #> 95744 bytes # drops entries related to trips that pass through specified stop_ids smaller_gtfs <- filter_by_stop_id(gtfs, stop_ids, keep = FALSE) object.size(smaller_gtfs) #> 741512 bytes