get_stop_frequency: Get Stop Frequency

View source: R/frequencies.R

get_stop_frequencyR Documentation

Get Stop Frequency

Description

Calculate the number of departures and mean headways for all stops within a given timespan and for given service_ids.

Usage

get_stop_frequency(
  gtfs_obj,
  start_time = "06:00:00",
  end_time = "22:00:00",
  service_ids = NULL,
  by_route = TRUE
)

Arguments

gtfs_obj

gtfs feed (tidygtfs object)

start_time

analysis start time, can be given as "HH:MM:SS", hms object or numeric value in seconds.

end_time

analysis period end time, can be given as "HH:MM:SS", hms object or numeric value in seconds.

service_ids

A set of service_ids from the calendar dataframe identifying a particular service id. If not provided, the service_id with the most departures is used.

by_route

Default TRUE, if FALSE then calculate headway for any line coming through the stop in the same direction on the same schedule.

Value

dataframe of stops with the number of departures and the headway (departures divided by timespan) in seconds as columns

Note

Some GTFS feeds contain a frequency data frame already. Consider using this instead, as it will be more accurate than what tidytransit calculates.

Examples

data(gtfs_duke)
stop_frequency <- get_stop_frequency(gtfs_duke)
x <- order(stop_frequency$mean_headway)
head(stop_frequency[x,])

tidytransit documentation built on Oct. 18, 2024, 5:13 p.m.