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. This function is called in read_gtfs.

Usage

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

Arguments

gtfs_obj

A GTFS object

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 tidygtfs with a validation_result attribute. This attribute is a tibble 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
local_gtfs_path <- system.file("extdata", "google_transit_nyc_subway.zip", package = "tidytransit")
gtfs <- read_gtfs(local_gtfs_path)
attr(gtfs, "validation_result")

gtfs$shapes <- NULL
validation_result <- validate_gtfs(gtfs)

# should raise a warning
gtfs$stop_times <- NULL
validation_result <- validate_gtfs(gtfs)

tidytransit documentation built on Nov. 23, 2021, 5:08 p.m.