Learn R Programming

tidytransit (version 0.5.1)

set_date_service_table: Returns all possible date/service_id combinations as a data frame

Description

Use it to summarise service. For example, get a count of the number of services for a date. See example.

Usage

set_date_service_table(gtfs_obj)

Arguments

gtfs_obj

a gtfs_object as read by read_gtfs

Value

a date_service data frame

Examples

Run this code
# NOT RUN {
library(dplyr)
local_gtfs_path <- system.file("extdata", "google_transit_nyc_subway.zip", package = "tidytransit")
nyc <- read_gtfs(local_gtfs_path, local=TRUE) %>% set_date_service_table()
nyc_services_by_date <- nyc$.$date_service_table
# count the number of services running on each date
nyc_services_by_date %>% group_by(date) %>% count()

# }

Run the code above in your browser using DataLab