import_gtfs {gtfsio} | R Documentation |
Import GTFS transit feeds
Description
Imports GTFS transit feeds from either a local .zip
file or an URL.
Columns are parsed according to the standards for reading and writing GTFS
feeds specified in get_gtfs_standards
.
Usage
import_gtfs(
path,
files = NULL,
fields = NULL,
extra_spec = NULL,
skip = NULL,
quiet = TRUE,
encoding = "unknown"
)
Arguments
path |
A string. The path to a GTFS |
files |
A character vector. The text files to be read from the GTFS,
without the |
fields |
A named list. The fields to be read from each text file, in the
format |
extra_spec |
A named list. Custom specification used when reading
undocumented fields, in the format
|
skip |
A character vector. Text files that should not be read from the
GTFS, without the |
quiet |
A logical. Whether to hide log messages and progress bars
(defaults to |
encoding |
A string. Passed to |
Value
A GTFS object: a named list of data frames, each one corresponding to a distinct text file from the given GTFS feed.
See Also
Other io functions:
export_gtfs()
Examples
gtfs_path <- system.file("extdata/ggl_gtfs.zip", package = "gtfsio")
# read all files and columns
gtfs <- import_gtfs(gtfs_path)
names(gtfs)
names(gtfs$trips)
# read all columns from selected files
gtfs <- import_gtfs(gtfs_path, files = c("trips", "stops"))
names(gtfs)
names(gtfs$trips)
# read specific columns from selected files
gtfs <- import_gtfs(
gtfs_path,
files = c("trips", "stops"),
fields = list(
trips = c("route_id", "trip_id"),
stops = c("stop_id", "stop_lat", "stop_lon")
)
)