View source: R/get_frequency.R
get_frequency | R Documentation |
The 'get_frequency' function calculates route frequency within a 'wizardgtfs' object using different methods. Depending on the selected 'method', it can provide daily frequencies by route, shape, stop or detailed hourly frequencies.
get_frequency(gtfs, method = "by.route")
gtfs |
A GTFS object, ideally of class 'wizardgtfs'. If not, it will be converted. |
method |
A character string specifying the calculation method. Options include:
|
This function calls specific sub-functions based on the selected method:
- "by.route": Calculates the total daily frequency for each route.
- "by.shape": Calculates the total daily frequency for each shape.
- "by.stop": Calculates the total daily frequency for each stop.
- "detailed": Provides an hourly breakdown of frequency, showing the number of departures per hour for each route and direction.
If an invalid 'method' is specified, the function defaults to '"by.route"' and provides a warning.
A data frame containing route frequencies based on the specified method:
Returns a data frame with columns: 'route_id', 'direction_id', 'daily.frequency', 'service_pattern', and 'pattern_frequency'.
Returns a data frame with columns: 'shape_id', 'direction_id', 'daily.frequency', 'service_pattern', and 'pattern_frequency'.
Returns a data frame with columns: 'stop_id', 'direction_id', 'daily.frequency', 'service_pattern', and 'pattern_frequency'.
Returns a data frame with columns: 'route_id', 'direction_id', 'hour', 'frequency', 'service_pattern', and 'pattern_frequency'.
[GTFSwizard::as_wizardgtfs()], [GTFSwizard::get_servicepattern()]
# Calculate daily route frequency
frequency_by_route <- get_frequency(gtfs = for_rail_gtfs, method = "by.route")
# Calculate daily shape frequency
frequency_by_shape <- get_frequency(gtfs = for_rail_gtfs, method = "by.shape")
# Calculate daily stop frequency
frequency_by_stop <- get_frequency(gtfs = for_rail_gtfs, method = "by.stop")
# Calculate detailed hourly frequency
detailed_frequency <- get_frequency(gtfs = for_rail_gtfs, method = "detailed")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.