-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME.Rmd
More file actions
114 lines (82 loc) · 2.18 KB
/
Copy pathREADME.Rmd
File metadata and controls
114 lines (82 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file. -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# transitmattr
An R package for the [TransitMatters Data Dashboard API](https://dashboard.transitmatters.org), providing access to MBTA performance metrics: headways, dwell times, travel times, ridership, speed restrictions, and more.
## Installation
```r
# install.packages("pak")
pak::pak("transitmatters/transitmattr")
```
Or with `remotes`:
```r
remotes::install_github("transitmatters/transitmattr")
```
## Usage
```r
library(transitmattr)
```
### No-parameter endpoints
```r
# Check API health
tm_healthcheck()
# List MBTA facilities
tm_facilities()
# Service ridership dashboard summary
tm_service_ridership_dashboard()
```
### Per-date endpoints
Functions accept either a `Date` object or a `"YYYY-MM-DD"` string.
```r
tm_headways("2024-01-15")
tm_dwells(as.Date("2024-01-15"))
tm_travel_times("2024-01-15")
# Dated or current alerts
tm_alerts()
tm_alerts("2024-01-15")
```
### Aggregate endpoints
```r
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
```r
# 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
```r
options(tm_dashboard_base_url = "https://your-staging-host.example.com")
```
## License
MIT