merge_gtfs {gtfstools} | R Documentation |
Merge GTFS files
Description
Combines many GTFS objects into a single one.
Usage
merge_gtfs(..., files = NULL, warnings, prefix = FALSE)
Arguments
... |
GTFS objects to be merged. Each argument can either be a GTFS or a list of GTFS objects. |
files |
A character vector listing the GTFS tables to be merged. If
|
warnings |
Whether to display warning messages (defaults to |
prefix |
Either a logical or a character vector (defaults to |
Value
A GTFS object in which each table is a combination (by row) of the tables from the specified GTFS objects.
Examples
spo_path <- system.file("extdata/spo_gtfs.zip", package = "gtfstools")
ggl_path <- system.file("extdata/ggl_gtfs.zip", package = "gtfstools")
spo_gtfs <- read_gtfs(spo_path)
names(spo_gtfs)
ggl_gtfs <- read_gtfs(ggl_path)
names(ggl_gtfs)
merged_gtfs <- merge_gtfs(spo_gtfs, ggl_gtfs)
names(merged_gtfs)
# use a list() to programatically merge many GTFS objects
gtfs_list <- list(spo_gtfs, ggl_gtfs)
merged_gtfs <- merge_gtfs(gtfs_list)
# 'prefix' helps disambiguating from which GTFS each id comes from.
# if TRUE, the ids range from 1:n, where n is the number of gtfs
merged_gtfs <- merge_gtfs(gtfs_list, prefix = TRUE)
merged_gtfs$agency
# if a character vector, its elements will be used to identify the each gtfs
merged_gtfs <- merge_gtfs(gtfs_list, prefix = c("spo", "ggl"))
merged_gtfs$agency