View source: R/get_dwelltimes.R
| get_dwelltimes | R Documentation |
The 'get_dwelltimes' function calculates dwell times within a 'wizardgtfs' object using different methods. Depending on the selected 'method', it can provide average dwell times per route, per trip, by hour, or detailed dwell times at each stop.
get_dwelltimes(gtfs, max_dwelltime = 90, method = "by_trip", ...)
gtfs |
A GTFS object, ideally of class 'wizardgtfs'. If not, it will be converted. |
max_dwelltime |
Numeric. Maximum allowable dwell time in seconds. |
method |
A character string specifying the calculation method. Options include:
|
... |
Supports the legacy argument 'max.dwelltime'. |
This function calls specific sub-functions based on the selected method:
- "by_hour": Calculates the average dwell time for each hour of the day.
- "by_route": Calculates average dwell times across each route.
- "by_trip": Calculates the mean dwell time for each trip.
- "detailed": Calculates departure minus arrival at each stop call.
Legacy dotted values remain accepted. If an invalid 'method' is specified, the function defaults to '"by_trip"' and provides a warning.
A data frame containing dwell times based on the specified method:
Returns a data frame with columns: 'hour', 'trips', 'average.dwelltime', 'service_pattern', and 'pattern_frequency'.
Returns 'route_id', optional 'direction_id', 'trips', 'average.dwelltime', 'service_pattern', and 'pattern_frequency'.
Returns 'route_id', 'trip_id', optional 'direction_id', 'average.dwelltime', 'service_pattern', and 'pattern_frequency'.
Returns 'route_id', 'trip_id', optional 'direction_id', 'stop_id', 'hour', 'dwell_time', 'service_pattern', and 'pattern_frequency'.
[GTFSwizard::as_wizardgtfs()], [GTFSwizard::get_servicepattern()]
# Calculate dwell times by hour
dwelltimes_by_hour <- get_dwelltimes(gtfs = for_rail_gtfs, max_dwelltime = 120, method = "by_hour")
# Calculate dwell times by route
dwelltimes_by_route <- get_dwelltimes(gtfs = for_rail_gtfs, max_dwelltime = 90, method = "by_route")
# Calculate dwell times by trip
dwelltimes_by_trip <- get_dwelltimes(gtfs = for_rail_gtfs, max_dwelltime = 45, method = "by_trip")
# Calculate detailed dwell times between stops
detailed_dwelltimes <- get_dwelltimes(gtfs = for_rail_gtfs, max_dwelltime = 60, method = "detailed")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.