MyNixOS website logo
Description

Read and Write General Transit Feed Specification (GTFS) Files.

Tools for the development of packages related to General Transit Feed Specification (GTFS) files. Establishes a standard for representing GTFS feeds using R data types. Provides fast and flexible functions to read and write GTFS feeds while sticking to this standard. Defines a basic 'gtfs' class which is meant to be extended by packages that depend on it. And offers utility functions that support checking the structure of GTFS objects.

gtfsio

CRANstatus gtfsio statusbadge Bstatus Codecov testcoverage Lifecycle:maturing CRAN/METACRAN Totaldownloads

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. 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:

install.packages("gtfsio")

Development version:

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:

library(gtfsio)

path <- system.file("extdata/ggl_gtfs.zip", package = "gtfsio")

gtfs <- import_gtfs(path)

names(gtfs)
#>  [1] "calendar_dates"  "fare_attributes" "fare_rules"     
#>  [4] "feed_info"       "frequencies"     "levels"         
#>  [7] "pathways"        "routes"          "shapes"         
#> [10] "stop_times"      "stops"           "transfers"      
#> [13] "translations"    "trips"           "agency"         
#> [16] "attributions"    "calendar"

import_gtfs() returns a gtfs object. The gtfs class might be extended by other packages using the constructor, validator and methods provided by gtfsio:

class(gtfs)
#> [1] "gtfs" "list"

Use the export_gtfs() function to write GTFS objects to disk:

tmpf <- tempfile(fileext = ".zip")

export_gtfs(gtfs, tmpf)

zip::zip_list(tmpf)$filename
#>  [1] "calendar_dates.txt"  "fare_attributes.txt"
#>  [3] "fare_rules.txt"      "feed_info.txt"      
#>  [5] "frequencies.txt"     "levels.txt"         
#>  [7] "pathways.txt"        "routes.txt"         
#>  [9] "shapes.txt"          "stop_times.txt"     
#> [11] "stops.txt"           "transfers.txt"      
#> [13] "translations.txt"    "trips.txt"          
#> [15] "agency.txt"          "attributions.txt"   
#> [17] "calendar.txt"

For a more complete demonstration please read the introductory vignette.

GTFS-related packages

Metadata

Version

1.1.1

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows