Chapter 3 Transit Frequencies

Here we focus on questions like:

  • What are the bus routes with the most frequent service in Los Angeles?
  • What are the bus stops with the most frequent service in Los Angeles?

3.1 Calculate Frequency

3.1.1 Attach Required Packages

3.1.2 Import Data

Note that you can replace the URL below with any other transit agency GTFS URL.

For example, below we read Los Angeles’ bus data directly from their GitLab URL.

3.1.3 Headway Statistics

3.1.3.1 By Route

List the routes with the shortest median headways.

## # A tibble: 6 x 5
##   route_id  median_headways mean_headways st_dev_headways stop_count
##   <chr>               <int>         <int>           <dbl>      <int>
## 1 901-13113               8             9            3.34         36
## 2 720-13113              10            25           73.3          90
## 3 51-13113               11            15            7.7         232
## 4 601-13113              11            11            0.07         20
## 5 14-13113               12            15            6.99        183
## 6 18-13113               12            26          108.          156

3.1.4 By Stop

List the stops with the shortest headways in the system.

## Joining, by = "stop_id"
## Adding missing grouping variables: `route_id`, `direction_id`, `stop_id`
## # A tibble: 6 x 5
## # Groups:   route_id, direction_id, stop_id [6]
##   route_id  direction_id stop_id stop_name              headway
##   <chr>            <int> <chr>   <chr>                    <dbl>
## 1 901-13113            1 15438   De Soto Station           7.11
## 2 901-13113            1 15312   Pierce College Station    7.16
## 3 901-13113            1 15435   Tampa Station             7.16
## 4 901-13113            1 15415   Reseda Station            7.22
## 5 901-13113            1 15515   Balboa Station            7.27
## 6 901-13113            1 15535   Sepulveda Station         7.27

3.1.4.1 Custom Time and Day

tidytransit calculates and attaches route and stop frequency data frames to the list of gtfs tables when you read gtfs data. Note that it makes assumptions about days of the week and time of day that you can set yourself by using: get_route_frequency and get_stop_frequency directly.