Reads GTFS text files from either a local .zip file or an URL and validates them against GTFS specifications.

read_gtfs(path, files = NULL, quiet = TRUE)

Arguments

path

The path to a GTFS .zip file.

files

A character vector containing the text files to be read from the GTFS (without the .txt extension). If NULL (the default) all existing files are read.

quiet

Whether to hide log messages and progress bars (defaults to TRUE).

Value

A tidygtfs object: a list of tibbles in which each entry represents a GTFS text file. Additional tables are stored in the . sublist.

See also

Examples

local_gtfs_path <- system.file("extdata", "google_transit_nyc_subway.zip", package = "tidytransit") gtfs <- read_gtfs(local_gtfs_path) names(gtfs)
#> [1] "trips" "stop_times" "agency" "calendar" #> [5] "calendar_dates" "stops" "routes" "shapes" #> [9] "transfers" "."
gtfs <- read_gtfs(local_gtfs_path, files = c("trips", "stop_times"))
#> Warning: Invalid feed. Missing required file(s): agency.txt, stops.txt, routes.txt, calendar_dates.txt
names(gtfs)
#> [1] "trips" "stop_times" "."