View source: R/get_1stdeparture.R
get_1stdeparture | R Documentation |
Extracts the first departure time for each trip in a 'wizardgtfs' object, along with the associated 'route_id', and 'stop_id' where the first departure occurs.
get_1stdeparture(gtfs)
gtfs |
A GTFS object. If not of class 'wizardgtfs', it will be converted internally using 'as_wizardgtfs()'. This may increase computation time. |
This function identifies the first departure time for each trip in the GTFS dataset. It uses the 'stop_times' table to find the earliest 'departure_time' for each 'trip_id' and joins this information with the 'trips' table to include the corresponding 'route_id'. The result is a tidy tibble suitable for further analysis or visualization.
If the input GTFS object is not of the 'wizardgtfs' class, the function converts it using 'as_wizardgtfs()'. A message is displayed to inform the user about the conversion.
A tibble with the following columns:
ID of the route associated with the trip.
ID of the trip.
Time of the first departure for the trip, as a character string in "HH:MM:SS" format.
ID of the stop where the first departure occurs.
[GTFSwizard::as_wizardgtfs()]
# Load GTFS data
gtfs <- for_rail_gtfs
# Get the first departures
first_departures <- get_1stdeparture(gtfs)
head(first_departures)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.