-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
55 lines (38 loc) · 1.43 KB
/
README.Rmd
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
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
[![Travis build status](https://travis-ci.org/zamorarr/wmata.svg?branch=master)](https://travis-ci.org/zamorarr/wmata)
# wmata
This package provides a R interface to the Washington Metropolitan Area Transit Authority (WMATA) [API](https://developer.wmata.com/)
## Usage
You can use this interface to query the WMATA API. For example, you can get the real time predictions for train arrivals at Metro Center (code A01):
```{r example}
library(wmata)
# get data
j <- next_trains("A01")
# show just the first 3 results
str(j$Trains[1:3], 2)
```
A data frame with mappings from stations to station codes is provided as the object `stations`:
```{r}
head(stations[c("Code", "Name")], 10)
```
## Installation
You can install the released version of wmata from [GitHub](https://github.com/zamorarr/wmata) with:
```{r eval=FALSE}
devtools::install_github("zamorarr/wmata")
```
You will also have to sign up for a WMATA developer key at [https://developer.wmata.com/](https://developer.wmata.com/). Once you get a key, edit your .Renviron file and place this line in there (replacing XXX with your key):
```sh
WMATA_KEY=XXXXXXX
```
You can use `usethis::edit_r_environ()` to edit your .Renviron file.