Skip to contents

The ntdr package provides a convenient interface to retrieve monthly data from the National Transit Database (NTD). Without this package, getting NTD data involves going to the NTD website and downloading and processing a complex Excel workbook.

The NTD data returned by this package has many quirks. Please use it with care and report any issues.

To learn more about the package, visit the package website: https://vgxhc.github.io/ntdr/.

Installation

# The latest stable version can be installed from CRAN:
install.packages("ntdr")


# Alternatively, install the latest development version from GitHub:
remotes::install_github("vgXhc/ntdr")

Example

Basic usage:

library(ntdr)
ntd_madison <- get_ntd(data_type = "adjusted", ntd_variable = "UPT", agency = "City of Madison", modes = "MB")
#> New names:
#> • `2033379` -> `2033379...25`
#> • `2033379` -> `2033379...27`
head(ntd_madison)
#> # A tibble: 6 × 13
#>   ntd_id_5 ntd_id_4 agency       active reporter_type uace  uza_name modes tos  
#>   <chr>    <chr>    <chr>        <chr>  <chr>         <chr> <chr>    <chr> <chr>
#> 1 50005    5005     City of Mad… Active Full Reporte… 53200 Madison… MB    DO   
#> 2 50005    5005     City of Mad… Active Full Reporte… 53200 Madison… MB    DO   
#> 3 50005    5005     City of Mad… Active Full Reporte… 53200 Madison… MB    DO   
#> 4 50005    5005     City of Mad… Active Full Reporte… 53200 Madison… MB    DO   
#> 5 50005    5005     City of Mad… Active Full Reporte… 53200 Madison… MB    DO   
#> 6 50005    5005     City of Mad… Active Full Reporte… 53200 Madison… MB    DO   
#> # ℹ 4 more variables: modes_simplified <chr>, month <date>, value <dbl>,
#> #   ntd_variable <chr>