| synthesize_table | R Documentation |
Synthesise one table
synthesize_table(
src,
spec = NULL,
n_folds = 10,
n_cycles = 1,
censor_mode = c("cell", "row"),
lock_threshold = 0.95,
max_predictors = 25,
minbucket = 5,
cp = 1e-04,
aux = NULL,
aux_always = TRUE,
nonsubject = c("blank", "keep"),
seed = NULL,
verbose = TRUE
)
src |
A |
spec |
Column spec; inferred with |
n_folds |
Number of folds; each round censors 1/ |
n_cycles |
Full sweeps over all folds. |
censor_mode |
The privacy-utility dial.
|
lock_threshold |
Cell mode only: columns whose screening association
(largest absolute correlation between value, missingness and level
signals) reaches this value form a lock group, share a fold and are
redrawn in sequence without seeing each other's censored cells. This
re-rolls coupled pairs (flag + date) that would otherwise stay real.
|
max_predictors |
Predictors per target after screening. |
minbucket, cp |
rpart controls (minimum donor pool per leaf, complexity). |
aux |
Optional auxiliary predictors from |
aux_always |
If |
nonsubject |
What to do with non-subject rows (totals, site headers):
|
seed |
Random seed. |
verbose |
Print progress. |
A synth_result: synthetic (raw character data.frame in the
source layout), spec, log, nonsubject rows, settings, and the
source metadata needed to write it out.
df <- data.frame(id = sprintf("AB%03d", 1:60), value = 1:60,
code = rep(c(0, 1, NA), 20), group = rep(c("A", "B"), 30))
path <- file.path(tempdir(), "synthesize_table.csv")
utils::write.csv(df, path, row.names = FALSE, na = "")
src <- read_source(path)
res <- synthesize_table(src, n_folds = 2, seed = 1, verbose = FALSE)
head(res$synthetic)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.