Skip to contents

Filter a GTFS data by keeping only the first trip of each shape_id, using gtfstools::filter_by_trip_id(). Trips without a shape_id are dropped. The other tables (stop_times, frequencies, shapes, routes, stops, calendar, etc.) keep only the rows used by the remaining trips. The input data is not modified.

Usage

filter_single_trip(gtfs_data)

Arguments

gtfs_data

A list of data.tables read using gtfs2gps::read_gtfs().

Value

A filtered GTFS data.

Examples

poa <- read_gtfs(system.file("extdata/poa.zip", package = "gtfs2gps"))
#> Unzipped the following files to /tmp/RtmpL1LF2I/gtfsio:
#>   * agency.txt
#>   * calendar.txt
#>   * routes.txt
#>   * shapes.txt
#>   * stop_times.txt
#>   * stops.txt
#>   * trips.txt
#> Reading agency
#> Reading calendar
#> Reading routes
#> Reading shapes
#> Reading stop_times
#> Reading stops
#> Reading trips

subset <- filter_single_trip(poa)