Learn R Programming

GTFSwizard (version 1.1.0)

get_servicepattern: Identify Service Patterns in GTFS Data

Description

The `get_servicepattern` function identifies and organizes unique service patterns within a `wizardgtfs` object. It groups services by common dates of operation and assigns each a frequency-based pattern identifier.

Usage

get_servicepattern(gtfs)

Value

A data frame containing unique service patterns with the following columns:

`service_id`

Unique identifier(s) for each service.

`service_pattern`

An identifier for each distinct service pattern based on operational dates, in the format "servicepattern-N".

`pattern_frequency`

The frequency of each service pattern, indicating the number of dates associated with that pattern.

Arguments

gtfs

A GTFS object, ideally of class `wizardgtfs`. If not, it will be converted.

Details

The function first checks if the input `gtfs` object is of class `wizardgtfs`. If not, it converts it using `as_wizardgtfs()`. It then groups services by common dates of operation, assigns a frequency to each unique pattern, and organizes these into service pattern identifiers, ordered by their frequency.

See Also

[GTFSwizard::as_wizardgtfs()]

Examples

Run this code
# Generate service patterns for a GTFS object
service_patterns <- get_servicepattern(gtfs = for_rail_gtfs)

Run the code above in your browser using DataLab