route_type
(transport mode)R/filter_by_route_type.R
filter_by_route_type.Rd
Filters a GTFS object by route_type
s, keeping (or dropping) the relevant
entries in each file.
filter_by_route_type(gtfs, route_type, keep = TRUE)
A GTFS object, as created by read_gtfs()
.
An integer vector. The route_type
s used to filter the
data.
A logical. Whether the entries related to the specified
route_type
s should be kept or dropped (defaults to TRUE
, which keeps
the entries).
The GTFS object passed to the gtfs
parameter, after the filtering
process.
Valid options are:
0 - Tram, Streetcar, Light rail. Any light rail or street level system within a metropolitan area.
1 - Subway, Metro. Any underground rail system within a metropolitan area.
2 - Rail. Used for intercity or long-distance travel.
3 - Bus. Used for short- and long-distance bus routes.
4 - Ferry. Used for short- and long-distance boat service.
5 - Cable tram. Used for street-level rail cars where the cable runs beneath the vehicle, e.g., cable car in San Francisco.
6 - Aerial lift, suspended cable car (e.g., gondola lift, aerial tramway). Cable transport where cabins, cars, gondolas or open chairs are suspended by means of one or more cables.
7 - Funicular. Any rail system designed for steep inclines.
11 - Trolleybus. Electric buses that draw power from overhead wires using poles.
12 - Monorail. Railway in which the track consists of a single rail or a beam.
Other filtering functions:
filter_by_agency_id()
,
filter_by_route_id()
,
filter_by_service_id()
,
filter_by_sf()
,
filter_by_shape_id()
,
filter_by_stop_id()
,
filter_by_time_of_day()
,
filter_by_trip_id()
,
filter_by_weekday()
# read gtfs
data_path <- system.file("extdata/spo_gtfs.zip", package = "gtfstools")
gtfs <- read_gtfs(data_path)
object.size(gtfs)
#> 811304 bytes
# keeps entries related to passed route_types
smaller_gtfs <- filter_by_route_type(gtfs, route_type = 1)
object.size(smaller_gtfs)
#> 180920 bytes
# drops entries related to passed route_types
smaller_gtfs <- filter_by_route_type(gtfs, route_type = 1, keep = FALSE)
object.size(smaller_gtfs)
#> 654360 bytes