Get Stop Frequency

get_stop_frequency(gtfs_obj, start_hour = 6, end_hour = 22,
  service_id = "", 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 7)

end_hour

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

service_id

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

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

a gtfs_obj with a dataframe of stops with a "Trips" variable representing the count trips taken through each stop for a route within a given time frame

Examples

data(gtfs_obj) gtfs_obj <- get_stop_frequency(gtfs_obj) x <- order(gtfs_obj$stops_frequency_df$headway) head(gtfs_obj$stops_frequency_df[x,])
#> # A tibble: 6 x 6 #> route_id direction_id stop_id service_id departures headway #> <chr> <int> <chr> <chr> <int> <dbl> #> 1 1693 0 778058 c_853_b_6573_d_31 272 3.53 #> 2 1693 0 778058 c_853_b_6872_d_31 272 3.53 #> 3 1683 0 778127 c_839_b_608_d_31 143 6.71 #> 4 1693 0 778059 c_853_b_6573_d_31 136 7.06 #> 5 1693 0 778059 c_853_b_6872_d_31 136 7.06 #> 6 1693 0 778060 c_853_b_6573_d_31 136 7.06