Learn R Programming

GTFSwizard (version 1.1.0)

merge_gtfs: Merge Two GTFS Datasets

Description

`merge_gtfs` combines two GTFS datasets into a single `wizardgtfs` object, with an option to append suffixes to ensure unique identifiers across tables.

Usage

merge_gtfs(gtfs.x, gtfs.y, suffix = TRUE)

Value

A merged `wizardgtfs` object containing all records from `gtfs.x` and `gtfs.y` across GTFS tables.

Arguments

gtfs.x

The first GTFS dataset, ideally of class `wizardgtfs`. If not, it will be converted.

gtfs.y

The second GTFS dataset, ideally of class `wizardgtfs`. If not, it will be converted.

suffix

A logical value. If `TRUE`, appends `.x` and `.y` suffixes to identifier columns in `gtfs.x` and `gtfs.y`, respectively, to prevent conflicts.

Details

- When `suffix = TRUE`, unique suffixes are appended to key identifiers in `gtfs.x` and `gtfs.y` (e.g., `agency_id`, `route_id`, `trip_id`).

- After suffix handling, the function merges individual tables, ensuring no duplicated entries.

- Finally, the resulting list is converted into a `wizardgtfs` object.

See Also

[GTFSwizard::as_wizardgtfs()]

Examples

Run this code
# Merge two GTFS datasets with suffix handling
merged_gtfs <- merge_gtfs(for_rail_gtfs, for_bus_gtfs, suffix = TRUE)

Run the code above in your browser using DataLab