Checks the existence of fields, represented by columns, inside a GTFS object element.

check_fields_exist(x, file, fields)

assert_fields_exist(x, file, fields)

Arguments

x

A GTFS object.

file

A string. The element, that represents a GTFS text file, where fields should be searched.

fields

A character vector. The fields to check the existence of.

Value

check_fields_exist returns TRUE if the check is successful, and FALSE otherwise.
assert_fields_exist returns x invisibly if the check is successful, and throws an error otherwise.

See also

Other checking functions: check_fields_types(), check_files_exist()

Examples

gtfs_path <- system.file("extdata/ggl_gtfs.zip", package = "gtfsio")
gtfs <- import_gtfs(gtfs_path)

check_fields_exist(gtfs, "calendar", c("monday", "tuesday"))
#> [1] TRUE

check_fields_exist(gtfs, "calendar", c("monday", "oi"))
#> [1] FALSE