synthesize: Fit a synthesizer and generate synthetic data in one step

View source: R/synthesizer.R

synthesizeR Documentation

Fit a synthesizer and generate synthetic data in one step

Description

synthesize() is a convenience wrapper around fit_synthesizer() and generate(). Optionally the result is written to a file in any format supported by write_data().

Usage

synthesize(
  data,
  n = NULL,
  seed = NULL,
  dependence = 1,
  closeness = 1,
  perturb = NULL,
  file = NULL,
  format = NULL,
  ...
)

Arguments

data

Training data (data frame, matrix, vector or ts).

n

Number of synthetic records. Defaults to the size of data.

seed

Optional random seed (applies to fitting and generation).

dependence

Dependence strength in [0, 1]; see generate().

closeness, perturb

Closeness to the real data and optional perturbation; see generate().

file

Optional output file path. The format is inferred from the extension (see supported_formats()).

format

Optional explicit file format, overriding the extension.

...

Arguments passed to fit_synthesizer().

Value

The synthetic data (invisibly if file is given).

Examples

syn <- synthesize(iris, n = 200, seed = 1)
summary(syn)

out <- tempfile(fileext = ".csv")
synthesize(mtcars, file = out, seed = 1)
head(read_data(out))

SynthesizerPlus documentation built on Oct. 16, 2026, 5:10 p.m.