SBC_generator_custom: Wrap a function the creates a complete dataset.

View source: R/datasets.R

SBC_generator_customR Documentation

Wrap a function the creates a complete dataset.

Description

This creates a very thin wrapper around the function and can store additional arguments, but does not do anything more..

Usage

SBC_generator_custom(f, ...)

Arguments

f

function accepting at least an n_sims argument and returning and SBC_datasets object

...

Additional arguments passed to f

Details

Running:

gen <- SBC_generator_custom(f, <<some other args>>)
datasets <- generate_datasets(gen, n_sims = my_n_sims)

is equivalent to just running

datasets <- f(<<some other args>>, n_sims = my_n_sims)

So whenever you control the code calling generate_datasets, it usually makes more sense to just create an SBC_datasets object directly and avoid using SBC_generator_custom and generate_datasets at all. SBC_generator_custom can however be useful, when a code you do not control calls generate_datasets for you and the built-in generators do not provide you with enough flexibility.


hyunjimoon/SBC documentation built on March 15, 2024, 3:18 a.m.