Skip to contents

For each route, returns the number of departures aggregated per hour.

Usage

get_route_frequency_hourly(
  gtfs,
  date = GTFShift::calendar_nextBusinessWednesday(),
  overline = FALSE
)

Arguments

gtfs

tidygtfs. GTFS feed.

date

Date (Default GTFShift::calendar_nextBusinessWednesday()). Reference date to consider when analyzing the GTFS file.

overline

Boolean (Default FALSE). If TRUE, routes are aggregated using stplanr::overline2(), overlapping lines and converting them into a single route network.

Value

An sf data.frame object with the following columns (the first three are only present if overline=FALSE):

  • route_id, the route_id attribute from routes.txt file.

  • route_short_name, the route_short_name attribute from routes.txt file.

  • direction_id, the direction_id attribute from trips.txt file.

  • hour, the hour for which the frequency applies (24 hour format).

  • frequency, the number of services for the route that depart from the first stop for the corresponding 60 minutes period.

  • geometry, the route shape.

Details

This method analyses the GTFS feed for a representative day, generating for each route the number of services aggregated per hour. For a detailed example, see the vignette("analyse").

Adapted from https://github.com/Bondify/GTFS_in_R/.

See also

[tidytransit::read_gtfs()], [stplanr::overline2], [GTFShift::calendar_nextBusinessWednesday]

Examples

if (FALSE) { # \dontrun{
gtfs = GTFShift::load_feed("gtfs.zip")
frequency_analysis = GTFShift::get_route_frequency_hourly(gtfs)
} # }