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

get_stop_frequency(gtfs_obj, start_hour = 6, end_hour = 22,
  service_ids = c(), dow = c(1, 1, 1, 1, 1, 0, 0), by_route = TRUE,
  wide = FALSE)

Arguments

gtfs_obj

a list of gtfs dataframes as read by read_gtfs().

start_hour

(optional) an integer indicating the start hour (default 6)

end_hour

(optional) an integer indicating the end hour (default 22)

service_ids

(optional) a set of service_ids from the calendar dataframe identifying a particular service id

dow

(optional) integer vector indicating which days of week to calculate for. default is weekday, e.g. c(1,1,1,1,1,0,0)

by_route

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

wide

(optional) if true, then return a wide rather than tidy data frame

Value

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

Examples

data(gtfs_duke) stop_frequency <- get_stop_frequency(gtfs_duke) x <- order(stop_frequency$headway) head(stop_frequency[x,])
#> # A tibble: 6 x 6 #> route_id direction_id stop_id service_id departures headway #> <chr> <int> <chr> <chr> <int> <int> #> 1 1683 0 778127 c_876_b_21969_d_31 143 7 #> 2 1683 0 778084 c_876_b_21969_d_31 128 8 #> 3 13048 0 789285 c_18017_b_22583_d_31 99 10 #> 4 1693 0 778058 c_16865_b_19493_d_31 92 10 #> 5 12945 0 778058 c_16865_b_19493_d_31 82 12 #> 6 1690 0 778095 c_876_b_21969_d_31 78 12