Generate mock data with the optional simstudy backend
Source:R/mock_spec_simstudy.R
generate_mock_data_simstudy.Rdgenerate_mock_data_simstudy() consumes a validated mock_spec and
generates baseline valid values through the optional simstudy package for
supported uniform continuous and categorical variables. MockData remains
responsible for missing-code injection, garbage values, and diagnostics
through postprocess_mock_data().
Details
Variables that need MockData semantics not covered by this milestone, such as truncated normal ranges and calendar dates, are generated by MockData's native path inside the same seeded call.
simstudy is an optional Suggests dependency and is GPL-3 licensed;
MockData remains MIT licensed by keeping this backend soft-gated and by
retaining generate_mock_data_native() as the default engine. Use this
backend when simstudy is installed and you want to exercise the optional
engine path. It currently delegates only categorical and uniform continuous
baseline generation to simstudy; unsupported variables are routed through
MockData's native backend so that a single specification can mix capabilities.
Missing-code assignment, garbage values, and diagnostics are not delegated to
simstudy. They remain MockData-owned post-processing so both backends share
the same auditability contract.
See also
generate_mock_data_native(), postprocess_mock_data(),
mock_spec()
Other mock generation APIs:
create_mock_data(),
generate_mock_data_native(),
postprocess_mock_data()
Examples
spec <- mock_continuous("age", range = c(18, 85), rtype = "integer")
if (requireNamespace("simstudy", quietly = TRUE)) {
data <- generate_mock_data_simstudy(spec, n = 10, seed = 1)
head(data)
}
#> age
#> 1 36
#> 2 43
#> 3 56
#> 4 79
#> 5 32
#> 6 78