sub-.gtfs: Subset a GTFS object

[.gtfsR Documentation

Subset a GTFS object

Description

Subsetting a GTFS object using [ preserves the object class.

Usage

## S3 method for class 'gtfs'
x[value]

Arguments

x

A GTFS object.

value

Either a numeric or a character vector. Designates the elements to be returned.

Value

A GTFS object.

Examples

gtfs_path <- system.file("extdata/ggl_gtfs.zip", package = "gtfsio")

gtfs <- import_gtfs(gtfs_path)
names(gtfs)
class(gtfs)

small_gtfs <- gtfs[1:5]
names(small_gtfs)
class(small_gtfs)

small_gtfs <- gtfs[c("shapes", "trips")]
names(small_gtfs)
class(small_gtfs)


gtfsio documentation built on Oct. 20, 2023, 9:08 a.m.