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_route_frequency(
  gtfs_obj,
  start_hour = 6,
  end_hour = 22,
  service_ids = c(),
  dow = c(1, 1, 1, 1, 1, 0, 0)
)

Arguments

gtfs_obj

a list of gtfs dataframes as read by the trread package.

start_hour

(optional) an integer, default 6 (6 am)

end_hour

(optional) an integer, default 22 (10 pm)

service_ids

(optional) a string from the calendar dataframe identifying a particular service schedule.

dow

(optional) an integer vector with days of week. monday=1. default: c(1,1,1,1,1,0,0)

Value

a dataframe of routes with variables (gtfs_obj$.$routes_frequency) for headway/frequency for a route within a given time frame

Examples

data(gtfs_duke) routes_frequency <- get_route_frequency(gtfs_duke)
#> A pre-calculated frequencies dataframe exists for this feed already, #> consider using that.
x <- order(routes_frequency$median_headways) head(routes_frequency[x,])
#> # A tibble: 6 x 6 #> route_id total_departures median_headways mean_headways st_dev_headways #> <chr> <int> <int> <int> <dbl> #> 1 1679 513 24 46 82.3 #> 2 1690 1242 25 24 3.83 #> 3 13048 942 27 23 6.05 #> 4 1681 770 27 27 4.69 #> 5 12945 1283 28 212 379. #> 6 1693 1224 32 222 386. #> # … with 1 more variable: stop_count <int>