| get_dates | R Documentation |
Returns the dates on which the GTFS object has service.
get_dates(gtfs, as_date = TRUE)
gtfs |
A GTFS object, as created by |
as_date |
A logical. Whether to return the dates as a |
A sorted vector of unique dates, either of class Date or a
character vector, depending on as_date. It is empty, without a warning,
if the GTFS object has no service date.
The GTFS object has service on a date if at least one of its services runs
on it. A service runs on the dates between the start_date and end_date
of its calendar entry whose weekday is flagged, minus the dates removed
from it in calendar_dates (exception_type 2), plus the dates added to it
(exception_type 1). Either table may be missing. If the trips table has
a service_id field, services not used by any trip are ignored, so each
returned date keeps at least one trip when passed to filter_by_date().
feed_info dates are not used.
get_calendar_overlap(), filter_by_date()
data_path <- system.file("extdata/ggl_gtfs.zip", package = "gtfstools")
gtfs <- read_gtfs(data_path)
# the calendar covers all of July 2006, but only weekends (plus 2006-07-03
# and 2006-07-04, added by calendar_dates) are returned, because the
# weekday service "WD" is not used by any trip
get_dates(gtfs)
# dates may also be returned in the "YYYYMMDD" format used by GTFS
get_dates(gtfs, as_date = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.