merge_gtfs: Merge Two GTFS Datasets

View source: R/merge_gtfs.R

merge_gtfsR Documentation

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)

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.

Value

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

Note

This function assumes that both input datasets follow GTFS structure. Non-standard tables or columns may be ignored or cause warnings.

See Also

[GTFSwizard::as_wizardgtfs()]

Examples

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


GTFSwizard documentation built on April 4, 2025, 4:10 a.m.