View source: R/get_active_services.R
| get_active_services | R Documentation |
Returns the services that are active on the given dates.
get_active_services(gtfs, date)
gtfs |
A GTFS object, as created by |
date |
A |
A data.table with the columns date (of class Date) and
service_id, with one row for each service active on each of the given
dates, sorted by date and then by service_id (in the C locale, so
uppercase letters come before lowercase ones). Dates on which no service is
active have no rows. service_id is never NA.
A service is active on a date if its calendar entry spans the date and
flags its weekday, unless the date is removed from it in calendar_dates
(exception_type 2), or if the date is added to it in calendar_dates
(exception_type 1). An addition wins over a removal on the same date,
and either table may be missing. If the trips table has a service_id
field, services not used by any trip are not returned, as in
get_dates(). If no service is active, an empty table is returned without
a warning.
get_dates(), filter_by_date()
data_path <- system.file("extdata/ggl_gtfs.zip", package = "gtfstools")
gtfs <- read_gtfs(data_path)
get_active_services(gtfs, "20060703")
# several dates, also as Date objects. only the weekend service "WE" is
# returned, because the weekday service "WD" is not used by any trip
get_active_services(gtfs, as.Date(c("2006-07-01", "2006-07-05")))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.