-
Notifications
You must be signed in to change notification settings - Fork 2
/
README.Rmd
80 lines (55 loc) · 2.75 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
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
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# gtfsio <img align="right" src="man/figures/logo.png" width="180">
[![CRAN status](https://www.r-pkg.org/badges/version/gtfsio)](https://CRAN.R-project.org/package=gtfsio)
[![gtfsio status badge](https://dhersz.r-universe.dev/badges/gtfsio)](https://dhersz.r-universe.dev)
[![B status](https://github.com/r-transit/gtfsio/workflows/R-CMD-check/badge.svg)](https://github.com/r-transit/gtfsio/actions?query=workflow%3AR-CMD-check)
[![Codecov test coverage](https://codecov.io/gh/r-transit/gtfsio/branch/master/graph/badge.svg)](https://app.codecov.io/gh/r-transit/gtfsio?branch=master)
[![Lifecycle: maturing](https://lifecycle.r-lib.org/articles/figures/lifecycle-maturing.svg)](https://lifecycle.r-lib.org/articles/stages.html)
[![CRAN/METACRAN Total downloads](http://cranlogs.r-pkg.org/badges/grand-total/gtfsio?color=yellow)](https://CRAN.R-project.org/package=gtfsio)
**gtfsio** offers tools for the development of GTFS-related packages. It establishes a standard for representing GTFS feeds using R data types based on [Google's Static GTFS Reference](https://developers.google.com/transit/gtfs/reference). It provides fast and flexible functions to read and write GTFS feeds while sticking to this standard. It defines a basic `gtfs` class which is meant to be extended by packages that depend on it. And it also offers utility functions that support checking the structure of GTFS objects.
## Installation
Stable version:
```{r, eval = FALSE}
install.packages("gtfsio")
```
Development version:
```{r, eval = FALSE}
install.packages("gtfsio", repos = "https://dhersz.r-universe.dev")
# or
# install.packages("remotes")
remotes::install_github("r-transit/gtfsio")
```
## Usage
GTFS feeds are read using the `import_gtfs()` function:
```{r}
library(gtfsio)
path <- system.file("extdata/ggl_gtfs.zip", package = "gtfsio")
gtfs <- import_gtfs(path)
names(gtfs)
```
`import_gtfs()` returns a `gtfs` object. The `gtfs` class might be extended by other packages using the constructor, validator and methods provided by **gtfsio**:
```{r}
class(gtfs)
```
Use the `export_gtfs()` function to write GTFS objects to disk:
```{r}
tmpf <- tempfile(fileext = ".zip")
export_gtfs(gtfs, tmpf)
zip::zip_list(tmpf)$filename
```
For a more complete demonstration please read the [introductory vignette](https://r-transit.github.io/gtfsio/articles/gtfsio.html).
## GTFS-related packages
- [`{tidytransit}`](https://github.com/r-transit/tidytransit)
- [`{gtfs2gps}`](https://github.com/ipeaGIT/gtfs2gps)
- [`{gtfsrouter}`](https://github.com/UrbanAnalyst/gtfsrouter)
- [`{gtfstools}`](https://github.com/ipeaGIT/gtfstools)