extract | R Documentation |
Extracts a list of synthetic data sets from a synthetic data object.
extract(object, drop = TRUE)
object |
object of class |
drop |
logical: if |
This function extracts a list of synthetic data sets from a synthetic data object as returned by synthesize
.
By default, the function drops the masked copies generated with mask.continuous
and mask.categorical
from the data set.
An object of class robosynth.list
(a list of data frames).
Simon Grund
synthesize
, mask.categorical
, mask.continuous
# create masked copies sociosexuality <- within(sociosexuality, { m_sex <- mask.categorical(sex, probability = .80) m_sexpref <- mask.categorical(sexpref, probability = .60) m_age <- mask.continuous(age, reliability = .90) }) # combine synthesis and masking models models <- combine.models( synthesis.model(sex ~ 1, type = "binary"), synthesis.model(sexpref ~ 1 + sex, type = "categorical"), synthesis.model(age ~ 1 + sex + sexpref, type = "continuous"), masking.model(m_sex ~ sex, type = "binary"), masking.model(m_sexpref ~ sexpref, type = "categorical"), masking.model(m_age ~ age, type = "continuous"), data = sociosexuality ) # run synthesis syn <- synthesize(models = models, m = 5, iter = 5) # * Example 1: synlist <- extract(syn) # * Example 2: keep masked copies synlist <- extract(syn, drop = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.