An R package for the TransitMatters Data Dashboard API, providing access to MBTA performance metrics: headways, dwell times, travel times, ridership, speed restrictions, and more.
Installation
# install.packages("pak")
pak::pak("transitmatters/transitmattr")Or with remotes:
remotes::install_github("transitmatters/transitmattr")Usage
No-parameter endpoints
# Check API health
tm_healthcheck()
# List MBTA facilities
tm_facilities()
# Service ridership dashboard summary
tm_service_ridership_dashboard()Aggregate endpoints
tm_aggregate_travel_times(
from_stop = "place-pktrm",
to_stop = "place-davis",
start_date = "2024-01-01",
end_date = "2024-01-31"
)
tm_aggregate_headways(
stop = "place-davis",
start_date = "2024-01-01",
end_date = "2024-01-31"
)Parameterized endpoints
# Ridership for the Red Line
tm_ridership("2024-01-01", "2024-01-31", line_id = "Red")
# Delay summary by line
tm_line_delays("2024-01-01", "2024-01-31", line = "Red")
# Trip metrics
tm_trip_metrics("2024-01-01", "2024-01-31", agg = "daily", line = "Red")
# Scheduled service (optionally filtered to one route)
tm_scheduled_service("2024-01-01", "2024-01-31", agg = "daily")
tm_scheduled_service("2024-01-01", "2024-01-31", agg = "daily", route_id = "Red")
# Speed restrictions / slow zones
tm_speed_restrictions("Red", "2024-01-15")
# Service hours
tm_service_hours("2024-01-01", "2024-01-31", agg = "daily")Overriding the base URL
options(tm_dashboard_base_url = "https://your-staging-host.example.com")