gtfstools (version 0.1.0)

write_gtfs: Write GTFS files

Description

Writes in-memory GTFS objects as GTFS .zip files. Conditionally includes optional and extra .txt files (check validate_gtfs documentation to check what are optional/extra files).

Usage

write_gtfs(
  gtfs,
  path,
  optional = TRUE,
  extra = TRUE,
  overwrite = TRUE,
  quiet = TRUE,
  warnings = TRUE
)

Arguments

gtfs

A GTFS object as created by read_gtfs.

path

The path to the .zip file in which the feed should be written to.

optional

Whether to write optional .txt. Defaults to TRUE.

extra

Whether to write extra .txt. Defaults to TRUE.

overwrite

Whether to overwrite existing .zip file. Defaults to TRUE.

quiet

Whether to hide log messages and progress bars (defaults to TRUE).

warnings

Whether to display warning messages (defaults to TRUE).

Value

Invisibly returns the provided GTFS object with an updated validation_result attribute.

See Also

validate_gtfs

Examples

Run this code
# NOT RUN {
data_path <- system.file("extdata/spo_gtfs.zip", package = "gtfstools")
gtfs <- read_gtfs(data_path)

tmp_dir <- file.path(tempdir(), "tmpdir")
dir.create(tmp_dir)
list.files(tmp_dir)

tmp_file <- tempfile(pattern = "gtfs", tmpdir = tmp_dir, fileext = ".zip")
write_gtfs(gtfs, tmp_file)
list.files(tmp_dir)

gtfs_all_files <- read_gtfs(tmp_file)
names(gtfs_all_files)

write_gtfs(gtfs_all_files, tmp_file, optional = FALSE)
gtfs_no_opt <- read_gtfs(tmp_file)
names(gtfs_no_opt)

# }

Run the code above in your browser using DataCamp Workspace