# \dontshow{
old_dt_threads <- data.table::setDTthreads(1)
on.exit(data.table::setDTthreads(old_dt_threads), add = TRUE)
# }
data_path <- system.file("extdata/ggl_gtfs.zip", package = "gtfstools")
gtfs <- read_gtfs(data_path)
gtfs$calendar
gtfs$calendar_dates
# keeps the services that run in the first week of july 2006, with their
# calendars cut to that week
smaller_gtfs <- filter_by_period(gtfs, "2006-07-01", "2006-07-07")
smaller_gtfs$calendar
# keeps the same services, with their whole calendars
smaller_gtfs <- filter_by_period(
gtfs,
"2006-07-01",
"2006-07-07",
trim = FALSE
)
smaller_gtfs$calendar
# dates may also be given as Date objects. drops the services that run in
# the period
smaller_gtfs <- filter_by_period(
gtfs,
as.Date("2006-07-03"),
as.Date("2006-07-04"),
keep = FALSE
)
smaller_gtfs$calendar
Run the code above in your browser using DataLab