| masque | R Documentation |
The front door. masque() walks the whole procedure - read the data,
propose column roles, (in an interactive session) pause for you to
review the plan, mask, audit, and optionally write the result - from a
single call. It dispatches on the input: a single file or data frame
goes through mask(); a folder, an Excel workbook, or a named list of
tables goes through mask_set().
masque(
input,
roles = NULL,
out = NULL,
mode = c("local", "collaborate"),
seed = NULL,
clean = c("auto", "report", "off"),
alias_names = FALSE,
conditional = FALSE,
ladder = c("hierarchy", "levels"),
ask = interactive(),
overwrite = FALSE,
quiet = FALSE,
allow_high = FALSE,
detect = TRUE,
sheets = NULL,
info = NULL,
...
)
input |
A data frame, a single tabular file ( |
roles |
Optional. A roles table (single-table input) or named list of roles tables (set input). When supplied, the interactive review is skipped. |
out |
Optional output path. For a single table, a |
mode |
Either |
seed |
Optional integer for reproducibility. |
clean |
Hygiene mode passed to |
alias_names |
Hide column names; see |
conditional |
Logical scalar (default |
ladder |
Drop order of the conditioning ladder, |
ask |
Whether to pause for interactive review when |
overwrite |
Passed to the writer when |
quiet |
Suppress progress messages. Warnings - including the HIGH-leakage finding - are never suppressed. |
allow_high |
Logical (default |
detect |
Logical (default |
sheets |
For an Excel workbook, the sheets to read (default: all).
See |
info |
For a set, names of documentation tables to set aside: not
masked and not written. See |
... |
Further arguments for the masking verb: |
It is also fully scriptable. Pass an edited roles table (or named
list of them) to skip the interactive review, and an out path to
write the masked result in one go. The returned object is the same
masque / masque_set you would get from the lower-level verbs, so
anything you can do with those you can do with the result here.
A masque object (single-table input) or a masque_set
object (set input), invisibly. Use synthetic() and recipe().
Read the input into one or more clean rectangular tables.
Propose roles for every column (skipped if you pass roles).
Review - in an interactive session with no roles supplied,
the proposed plan is printed and you are asked to proceed, edit, or
stop. Editing opens the roles table in the spreadsheet editor
(utils::edit()) where the platform provides one; when it cannot
start (for example macOS without XQuartz, or a headless session), a
console editor takes over - pick a column, then a role and an
action from numbered menus, with every change applied through
set_role() so default actions re-resolve exactly as on the
scriptable path. With ask = FALSE (the default in
non-interactive use) the proposed plan is used as-is, with a note.
Mask the data in the chosen mode.
Audit - in collaborate mode the leakage audit runs and its
headline is printed. A HIGH finding surfaces as a classed warning
(masque_high_leakage) - it is never silenced by the guided flow.
Write - if out is set, the masked data is written there
(mirroring the input format), unless the audit left unresolved
HIGH findings: then the write is refused (nothing is written) and
the flagged columns are listed. Resolve them and mask again, or
pass allow_high = TRUE after your own review - the override is
warned (masque_high_override) and recorded on the recipe. The
private recipe is never written automatically; persist it yourself
with save_recipe().
mask(), mask_set(), propose_roles(), set_role(),
apply_recipe() and unmask() for the round trip, save_recipe() to
keep the recipe, audit_mask(), data_card() and roles() to describe
the clone, write_set().
# Scripted single-table use (no prompt because roles are supplied):
r <- propose_roles(iris)
r <- set_role(r, "Sepal.Length", role = "outcome")
m <- masque(iris, roles = r, seed = 1, ask = FALSE, quiet = TRUE)
head(synthetic(m))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.