validate_gtfs: Validate GTFS file

Description Usage Arguments Value Details Examples

View source: R/validate_gtfs.R

Description

Validates the GTFS object against GTFS specifications and raises warnings if required files/fields are not found.

Usage

1
validate_gtfs(gtfs, files = NULL, quiet = TRUE, warnings = TRUE)

Arguments

gtfs

A GTFS object as created by read_gtfs.

files

A character vector containing the text files to be validated against the GTFS specification (without the .txt extension). If NULL (the default) the provided GTFS is validated against all possible GTFS text files.

quiet

Whether to hide log messages (defaults to TRUE).

warnings

Whether to display warning messages (defaults to TRUE).

Value

A GTFS object with a validation_result attribute. This attribute is a data.table containing the validation summary of all possible fields from the specified files.

Details

GTFS object's files and fields are validated against the GTFS specifications as documented in Google's Static GTFS Reference:

Note that some files (calendar.txt, calendar_dates.txt and feed_info.txt) are conditionally required. This means that:

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
data_path <- system.file("extdata/spo_gtfs.zip", package = "gtfstools")

gtfs <- read_gtfs(data_path)
attr(gtfs, "validation_result")

# should not raise a warning, because 'shapes' is not a required file
gtfs$shapes <- NULL
validation_result <- validate_gtfs(gtfs)

# should raise a warning, because 'stop_times' is a required file
gtfs$stop_times <- NULL
validation_result <- validate_gtfs(gtfs)

gtfstools documentation built on Feb. 23, 2021, 9:06 a.m.