get_frequency {GTFSwizard}R Documentation

Calculate Route Frequency in GTFS Data

Description

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 or detailed hourly frequencies.

Usage

get_frequency(gtfs, method = "by.route")

Arguments

gtfs

A GTFS object, ideally of class 'wizardgtfs'. If not, it will be converted.

method

A character string specifying the calculation method. Options include:

"by.route"

Calculates the total daily frequency for each route.

"detailed"

Calculates the hourly frequency for each route.

Details

This function calls specific sub-functions based on the selected method:

- "by.route": Calculates the total daily frequency for each route, summing up the number of trips for each route on a daily basis.

- "detailed": Provides an hourly breakdown of frequency, showing the number of departures per hour for each route.

If an invalid 'method' is specified, the function defaults to '"by.route"' and provides a warning.

Value

A data frame containing route frequencies based on the specified method:

If 'method = "by.route"'

Returns a data frame with columns: 'route_id', 'daily.frequency', 'service_pattern', and 'pattern_frequency'.

If 'method = "detailed"'

Returns a data frame with columns: 'route_id', 'hour', 'frequency', 'service_pattern', and 'pattern_frequency'.

See Also

[GTFSwizard::as_wizardgtfs()], [GTFSwizard::get_servicepattern()]

Examples

# Calculate daily route frequency
frequency_by_route <- get_frequency(gtfs = for_rail_gtfs, method = "by.route")

# Calculate detailed hourly frequency
detailed_frequency <- get_frequency(gtfs = for_rail_gtfs, method = "detailed")


[Package GTFSwizard version 1.0.0 Index]