make_synthesizer: Create a function that generates synthetic data

View source: R/synthesizer.R

make_synthesizerR Documentation

Create a function that generates synthetic data

Description

Create a function that accepts a non-negative integer n, and that returns synthetic data sampled from the emperical (multivariate) distribution of x.

Usage

make_synthesizer(x, ...)

## S3 method for class 'numeric'
make_synthesizer(x, ...)

## S3 method for class 'integer'
make_synthesizer(x, ...)

## S3 method for class 'logical'
make_synthesizer(x, ...)

## S3 method for class 'factor'
make_synthesizer(x, ...)

## S3 method for class 'character'
make_synthesizer(x, ...)

## S3 method for class 'ts'
make_synthesizer(x, ...)

## S3 method for class 'data.frame'
make_synthesizer(x, rankcor = 1, ...)

Arguments

x

[vector|data.frame] Template data to be synthesized.

...

arguments passed to other methods

rankcor

[numeric] in (0,1] The correlations between the ranks of the real data and synthetic data. Either a single number or a vector of the form c("variable1"=x1,...). Only used if x is a data frame.

Value

A function accepting a single integer argument: the number of synthesized values or records to return.

See Also

Other synthesis: synthesize()

Examples

synth <- make_synthesizer(cars$speed)
synth(10)


synth <- make_synthesizer(iris)
synth(6)
synth(150)
synth(250)


synthesizer documentation built on April 12, 2025, 2:27 a.m.