Get aggregated frequency per hour for each bus route
Source:R/get_route_frequency_hourly.R
get_route_frequency_hourly.Rd
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
, theroute_id
attribute fromroutes.txt
file.route_short_name
, theroute_short_name
attribute fromroutes.txt
file.direction_id
, thedirection_id
attribute fromtrips.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)
} # }