generate_synthetic_object: Generate synthetic vectors from their sampling distributions

View source: R/generate_synthetic_object.r

generate_synthetic_objectR Documentation

Generate synthetic vectors from their sampling distributions

Description

One way of creating synthetic data is replicating sampling distribution of the variable. This function can be applied to dataframes, numeric or character/factor vectors and obtain an object of equal length with synthetic values.

Usage

generate_synthetic_object(obj, seed = NULL, n_news = NULL)

## Default S3 method:
generate_synthetic_object(obj, seed = NULL, n_news = NULL)

## S3 method for class 'numeric'
generate_synthetic_object(obj, seed = NULL, n_news = NULL)

## S3 method for class 'data.frame'
generate_synthetic_object(obj, seed = NULL, n_news = NULL)

Arguments

obj

A dataframe, numeric vector or character/factor vector.

seed

Specify seed when replication is desired.

n_news

Length of the new vectors. By default, same length as input.

Value

An object of equal dimensions (if n_news is not specified) with synthetic values.

Examples

generate_synthetic_object(mtcars)

generate_synthetic_object(mtcars$mpg)

generate_synthetic_object(as.factor(mtcars$cyl))

octmedina/ksnet documentation built on April 18, 2023, 3:34 p.m.