get_ntd {ntdr}R Documentation

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"))


[Package ntdr version 0.4.0 Index]