| mask_set | R Documentation |
The set-level counterpart to mask(). Takes a folder of tabular
files, an Excel workbook, or a named list of data frames and produces
one synthetic table per input table plus a single private recipe
bundle. Columns that are shared across tables - a site code, a
genotype name, a plot id appearing in several tables - are aliased
identically everywhere they occur, so a join written against the
synthetic set still resolves on the masked data.
mask_set(
input,
roles = NULL,
links = NULL,
mode = c("local", "collaborate"),
seed = NULL,
clean = c("auto", "report", "off"),
alias_names = FALSE,
conditional = FALSE,
ladder = c("hierarchy", "levels"),
grain = TRUE,
allow_kept_outcome = FALSE,
quiet = FALSE,
sheets = NULL,
info = NULL,
...
)
input |
A folder path, an |
roles |
Optional named list of roles tables, one per input table
(names must match). When |
links |
Optional override for link detection: a character vector
of column names to treat as cross-table links, or |
mode |
Either |
seed |
Optional integer for reproducibility. |
clean |
Hygiene mode passed to |
alias_names |
Hide column names. |
conditional |
Logical scalar (default |
ladder |
Drop order of the conditioning ladder, |
grain |
Single logical (default |
allow_kept_outcome |
Single logical, passed to each |
quiet |
Logical; suppress the link / hygiene report, including the hint that a table looks like documentation. |
sheets |
For an Excel workbook, the sheets to read (default: all);
passed to |
info |
Optional character vector of table names (sheet names, or
file names without extension) to set aside as documentation, for
example a data dictionary. They are set aside before masking: not
masked, not in the synthetic set, not written by |
... |
Must be empty: any argument here is refused with
|
A masque_set S7 object. Use synthetic() for the named list
of synthetic tables and recipe() for the private recipe bundle.
A link is a column name that appears in two or more tables with a
compatible kind and overlapping values - the join keys of the set.
mask_set() proposes links automatically and prints them; pass
links to override. Linked columns are aliased in place with a shared
map (built over the union of values across all tables), so identical
original values map to identical aliases in every table. The aliases
read <col>_K001, <col>_K002, ..., assigned at random and, when seed
is set, the same for the same seed. Set a linked column's action to
keep in its roles table to pass it through unmasked instead.
mask(), read_set(), write_set(), audit_mask(),
data_card(), reveal_maps().
tables <- list(
plots = data.frame(
site = rep(c("A", "B", "C", "D", "E"), each = 2),
gen = rep(c("x", "y"), 5),
yield = c(3.1, 2.9, 4.0, 3.7, 3.3, 3.5, 2.8, 3.0, 3.9, 3.6)
),
sites = data.frame(
site = c("A", "B", "C", "D", "E"),
rainfall = c(420, 560, 390, 610, 480)
)
)
roles <- lapply(tables, propose_roles, mode = "collaborate")
roles <- lapply(roles, set_role, "site", action = "alias")
m <- mask_set(tables, roles = roles, seed = 1, quiet = TRUE)
synthetic(m)$plots$site
synthetic(m)$sites$site # same aliases -> the join still works
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.