tidy_raptor | R Documentation |
The 'tidy_raptor' function calculates travel times from a set of origin stops to all reachable stops within a GTFS dataset. It uses the RAPTOR (Round-Based Public Transit Routing) algorithm from the 'tidytransit' package and integrates it with the GTFSwizard framework.
tidy_raptor(
gtfs,
min_departure = "0:0:0",
max_arrival = "23:59:59",
dates = NULL,
stop_ids,
arrival = FALSE,
time_range = 3600,
max_transfers = NULL,
keep = "all",
filter = TRUE
)
gtfs |
A GTFS object, preferably of class 'wizardgtfs'. If not, the function will attempt to convert it using 'GTFSwizard::as_wizardgtfs()'. |
min_departure |
A string representing the earliest departure time, in "HH:MM:SS" format. Defaults to '"0:0:0"'. |
max_arrival |
A string representing the latest arrival time, in "HH:MM:SS" format. Defaults to '"23:59:59"'. |
dates |
A date (in '"YYYY-MM-DD"' format) to filter the GTFS dataset to specific calendar days. Defaults to 'NULL', meaning the furthest date. |
stop_ids |
A character vector of stop IDs from where journeys should start (or end, if 'arrival = TRUE'). |
arrival |
Logical. If 'FALSE' (default), journeys start from 'stop_ids'. If 'TRUE', journeys end at 'stop_ids'. |
time_range |
Either a range in seconds (numeric) or a vector with the minimal and maximal departure time (e.g., 'c(0, 3600)' or '"HH:MM:SS"') describing the journey window. |
max_transfers |
Maximum number of transfers allowed. Defaults to 'NULL' (no limit). |
keep |
One of '"all"', '"shortest"', '"earliest"', or '"latest"'. Determines which journeys to retain: - '"all"': All journeys are returned (default). - '"shortest"': Only journeys with the shortest travel time. - '"earliest"': Journeys arriving at stops the earliest. - '"latest"': Journeys arriving at stops the latest. |
filter |
A logical to filter for min_departure, max_arrivel, and dates. Defaults to 'TRUE'. |
A tibble containing the RAPTOR algorithm results, including:
The ID of the stop where the journey starts.
The ID of the stop where the journey ends.
Departure time from the origin stop.
Arrival time at the destination stop.
Total travel time in seconds.
Ensure that the 'stop_times' is present and correctly structured in the GTFS dataset. Time values in 'min_departure', 'max_arrival', and 'time_range' should be correctly formatted to avoid errors. 'max_arrival' must be 23:59:59 or earlier.
[tidytransit::raptor()], [GTFSwizard::as_wizardgtfs()], [GTFSwizard::filter_time()]
tidy_raptor(for_rail_gtfs,
min_departure = '06:20:00',
max_arrival = '09:40:00',
dates = "2021-12-13",
max_transfers = 2,
keep = "all",
stop_ids = '66')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.