read_gtfs | R Documentation |
Reads GTFS text files from either a local .zip
file or an URL.
read_gtfs(
path,
files = NULL,
fields = NULL,
skip = NULL,
quiet = TRUE,
encoding = "unknown"
)
path |
The path to a GTFS |
files |
A character vector containing the text files to be read from the
GTFS (without the |
fields |
A named list containing the fields to be read from each text
file, in the format |
skip |
A character vector containing the text files that should not be
read from the GTFS, without the |
quiet |
Whether to hide log messages and progress bars (defaults to
|
encoding |
A string, ultimately passed to |
A data.table
-based GTFS object: a list
of data.table
s in which
each table represents a GTFS text file.
The column types of each data.table
in the final GTFS object conform as
closely as possible to the Google's Static GTFS Reference. Exceptions are
date-related columns (such as calendar.txt
's start_date
and end_date
,
for example), which are converted to Date
objects, instead of being kept as
integer
s, allowing for easier data manipulation. These columns are
converted back to integer
s when writing the GTFS object to a .zip
file
using write_gtfs()
.
Other io functions:
write_gtfs()
data_path <- system.file("extdata/spo_gtfs.zip", package = "gtfstools")
gtfs <- read_gtfs(data_path)
names(gtfs)
gtfs <- read_gtfs(data_path, files = c("trips", "stop_times"))
names(gtfs)
gtfs <- read_gtfs(data_path, skip = "trips")
names(gtfs)
gtfs <- read_gtfs(data_path, fields = list(agency = "agency_id"))
names(gtfs)
names(gtfs$agency)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.