save_delta: Save a Delta dataset to disk

View source: R/utils.R

save_deltaR Documentation

Save a Delta dataset to disk

Description

This function saves a Delta dataset object to disk as three plain text files: "chars", "items", and "specs" in the DELTA format.

Usage

save_delta(delta, dir, prefix = "", overwrite = FALSE, width = 79)

Arguments

delta

A Delta dataset object (Rcpp_DeltaParser from load_delta())

dir

Path to the directory where files should be saved. This argument is required: the function never writes to the current working directory by default. Use tempdir() if you only need a scratch location.

prefix

Optional prefix for filenames (default: "")

overwrite

Whether to overwrite existing files (default: FALSE)

width

Maximum line width for output files (default: 79, range: 40-132)

Value

Invisibly returns the input delta object

Examples


try({
  delta <- load_delta(
    system.file("extdata", "chars_viola", package = "RDelta"),
    system.file("extdata", "items_viola", package = "RDelta"),
    system.file("extdata", "specs_viola", package = "RDelta")
  )

  # Write to a temporary directory
  save_delta(delta, dir = tempdir())

  # Write to a user-chosen directory with a prefix
  save_delta(delta, dir = tempdir(), prefix = "my_", overwrite = TRUE)

  # Use a wider output width
  save_delta(delta, dir = tempdir(), width = 120)
})


RDelta documentation built on Oct. 28, 2026, 5:12 p.m.