metro

Get DC transit data as R data frames

https://github.com/k5cents/metro

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (18.3%) to scientific vocabulary

Keywords

metro public-transportation transit-data washington-dc wmata wmata-api
Last synced: 6 months ago · JSON representation

Repository

Get DC transit data as R data frames

Basic Info
Statistics
  • Stars: 4
  • Watchers: 1
  • Forks: 0
  • Open Issues: 7
  • Releases: 1
Topics
metro public-transportation transit-data washington-dc wmata wmata-api
Created over 5 years ago · Last pushed almost 2 years ago
Metadata Files
Readme Changelog License

README.Rmd

---
output: github_document
editor_options: 
  chunk_output_type: console
---



```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  warning = FALSE,
  message = FALSE,
  error = FALSE,
  comment = "#>",
  fig.path = "man/figures/README-",
  fig.height = 4,
  fig.width = 9,
  out.width = "100%",
  dpi = 300
)
if (!interactive()) {
  options(width = 95)
}
```

# metro 


[![Lifecycle: experimental][life_badge]][life_link]
[![CRAN status][cran_badge]][cran_link]
![Downloads][dl_badge]
[![Codecov test coverage][cov_badge]][cov_link]
[![R build status][ga_badge]][ga_link]


The goal of metro is to return data frames from the Washington Metropolitan Area
Transit Authority API. Nested lists have been converted to [tidy] data frames
when possible.

## Installation

The release version of metro (0.9.1) can be installed from [CRAN][cran]:

```{r install_cran, eval=FALSE}
install.packages("metro")
```

Or install the development version from [GitHub][gh]:

```{r install_github, eval=FALSE}
# install.packages("devtools")
devtools::install_github("k5cents/metro")
```

## Key

Usage of the WMATA API requires a developer API key. Such a key can be obtained
by creating a developer account and subscribing to the free default tier.

The WMATA also provides a [demo key][demo] to try out the various features of
the API. This key should **never** be used in production, it is rate limited and
subject to change at any time.

```{r key, eval=FALSE}
Sys.setenv(WMATA_KEY = "e13626d03d8e4c03ac07f95541b3091b")
```

## Example

```{r library}
library(metro)
packageVersion("metro")
```

Functions return data frames for easy analysis.

```{r rail_stations}
next_train(StationCodes = "A01")
```

### Coordinates

Use coordinates to find station entrances or bus stops near a location. The
[`geodist::geodist()`][gd] function is used to calculate distance from the
supplied coordinates.

```{r rail_entrance}
# Washington Monument coordinates
rail_entrance(Lat = 38.890, Lon = -77.035, Radius = 750)[, -(3:4)]
```

### Dates and Times

Date columns with class `POSIXt` have been shifted from Eastern time to the UTC
time zone (+5 hours).

```{r bus_position}
bus_position(RouteId = "33")[, 1:8]
```

Time values are left in Eastern time and are represented using the class
[`hms`][hms], which counts the seconds since midnight. If the _last_ train on a
Saturday leaves at 1:21 AM (past midnight), this would be represented as
`25:21`.

```{r rail_times}
tail(rail_times(StationCode = "E10"))
```

### Data

Some data frames are includes as objects if their functions typically return the
same thing every time.

```{r lines}
metro_lines # rail_lines() for live
```


[life_badge]: https://img.shields.io/badge/lifecycle-stable-green
[life_link]: https://lifecycle.r-lib.org/articles/stages.html#stable
[cran_badge]: https://www.r-pkg.org/badges/version/metro
[cran_link]: https://CRAN.R-project.org/package=metro
[ga_badge]: https://github.com/k5cents/metro/workflows/R-CMD-check/badge.svg
[ga_link]: https://github.com/k5cents/metro/actions
[cov_badge]: https://codecov.io/gh/k5cents/metro/graph/badge.svg?token=bQ3eAdcpjd
[cov_link]: https://app.codecov.io/gh/k5cents/metro?branch=master'
[dl_badge]: https://cranlogs.r-pkg.org/badges/grand-total/gluedown
[tidy]: https://en.wikipedia.org/wiki/Tidy_data
[cran]: https://cran.r-project.org/package=metro
[gh]: https://github.com/k5cents/metro
[demo]: https://developer.wmata.com/products/5475f236031f590f380924ff
[gd]: https://github.com/hypertidy/geodist
[hms]: https://github.com/tidyverse/hms

Owner

  • Name: Kiernan Nicholls
  • Login: k5cents
  • Kind: user
  • Location: Washington, DC

Political data analyst

GitHub Events

Total
Last Year

Committers

Last synced: over 1 year ago

All Time
  • Total Commits: 173
  • Total Committers: 1
  • Avg Commits per committer: 173.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 20
  • Committers: 1
  • Avg Commits per committer: 20.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Kiernan Nicholls k****n@p****m 173

Packages

  • Total packages: 1
  • Total downloads:
    • cran 210 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 3
  • Total maintainers: 1
cran.r-project.org: metro

Washington Metropolitan Area Transit Authority API

  • Versions: 3
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 210 Last month
Rankings
Stargazers count: 24.2%
Forks count: 28.8%
Dependent packages count: 29.8%
Dependent repos count: 35.5%
Average: 40.1%
Downloads: 82.4%
Maintainers (1)
Last synced: 6 months ago

Dependencies

DESCRIPTION cran
  • R >= 2.10 depends
  • geodist >= 0.0.6 imports
  • hms >= 1.0.0 imports
  • httr >= 1.4.2 imports
  • jsonlite >= 1.7.1 imports
  • tibble >= 3.0.4 imports
  • covr >= 3.5.1 suggests
  • mockr >= 0.1 suggests
  • spelling >= 2.2 suggests
  • testthat >= 3.0.0 suggests
.github/workflows/check-standard.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pkgdown.yaml actions
  • JamesIves/github-pages-deploy-action v4.4.1 composite
  • actions/checkout v3 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml actions
  • actions/checkout v3 composite
  • actions/upload-artifact v3 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite