get_fleet: Estimates Fleet from GTFS Data

View source: R/get_fleet.R

get_fleetR Documentation

Estimates Fleet from GTFS Data

Description

The 'get_fleet' function estimates the fleet from a 'wizardgtfs' object using different methods. Depending on the selected 'method', it can estimates fleet by route, by hour, peak times, or detailed timepoints.

Usage

get_fleet(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 maximum number of simultaneous trips for each route.

"by.hour"

Calculates the maximum number of simultaneous trips by hour of the day across all routes.

"peak"

Calculates the maximum number of simultaneous trips for the three busiest hours.

"detailed"

Calculates the maximum number of simultaneous trips across each timepoint within a trip.

Details

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

- "by.route": Calculates the maximum simultaneous trips per route.

- "by.hour": Calculates the maximum simultaneous trips for each hour of the day.

- "peak": Calculates the maximum simultaneous trips for the three busiest hours.

- "detailed": Provides a timepoint-based fleet calculation, showing detailed fleet fluctutations over the course of the trip.

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

Value

A data frame containing the fleet based on the specified method:

If 'method = "by.route"'

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

If 'method = "by.hour"'

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

If 'method = "peak"'

Returns a data frame with columns: 'hour', 'fleet', 'service_pattern', and 'pattern_frequency' for the busiest three hours.

If 'method = "detailed"'

Returns a data frame with columns: 'route_id', 'net.fleet', 'fleet', 'time', 'service_pattern', and 'pattern_frequency' for each timepoint.

See Also

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

Examples

# Calculate fleet requirements by route
fleet_by_route <- get_fleet(gtfs = for_rail_gtfs, method = "by.route")

# Calculate fleet requirements by hour
fleet_by_hour <- get_fleet(gtfs = for_rail_gtfs, method = "by.hour")

# Calculate fleet requirements for peak hours
fleet_peak <- get_fleet(gtfs = for_rail_gtfs, method = "peak")

# Calculate detailed fleet requirements over timepoints
fleet_detailed <- get_fleet(gtfs = for_rail_gtfs, method = "detailed")


GTFSwizard documentation built on April 4, 2025, 4:10 a.m.