Package 'ntdr'

Title: Retrieve Data from the National Transit Database
Description: Downloads the latest 'National Transit Database' data, processes it, and returns in a tidy data format.
Authors: Harald Kliems [cre, aut, cph] , Eli Pousson [ctb]
Maintainer: Harald Kliems <[email protected]>
License: MIT + file LICENSE
Version: 0.4.0
Built: 2024-10-26 03:37:19 UTC
Source: CRAN

Help Index


Get National Transit Database (NTD) data

Description

[get_ntd()] downloads Excel file with the adjusted or raw monthly ridership files provided by the National Transit Database and transforms the data into a long-format data frame with one or more variable. Optionally cache the source spreadsheet or filter by agency or mode.

Usage

get_ntd(
  agency = "all",
  data_type = "adjusted",
  ntd_variable = "UPT",
  modes = "all",
  cache = getOption("ntdr.cache", FALSE)
)

Arguments

agency

Name of the transit agency to retrieve. Defaults to 'all' agencies

data_type

Type of NTD data. Either "raw" for data released without adjustments or "adjusted" for data with adjustments and estimates

ntd_variable

Which variable or variables to return. 'UPT' for unlinked passenger trips, 'VRM' for vehicle revenue miles, 'VRH' for vehicle revenue hours, or 'VOMS' for vehicles operated in maximum service.

modes

Transit mode or modes to retrieve. Common modes include 'MB' (bus), 'CR' (commuter rail), 'HR' (heavy rail), 'LR' (light rail). Defaults to 'all' modes.

cache

Cache downloaded data. Defaults to 'FALSE'. Set a default value with the "ntdr.cache" option.

Value

A data frame of monthly NTD data with the requested 'ntd_variable' in the 'value' column

Examples

get_ntd(agency = "City of Madison", modes = c("MB", "DR"))