Package: masque 0.18.0

masque: Synthetic Copies of Confidential Data Tables

Creates a synthetic copy of a confidential data table, so that analysis code can be written and tested without the real values. By default, every outcome and covariate is simulated independently, with no link to other columns or to the real rows. Each numeric column keeps only an eleven-point summary: its 1st percentile, deciles and 99th percentile. The experimental design and the pattern of missing values are kept exactly, and category labels, including those of the design and the treatments, are replaced by codes. Columns that look like identifiers or free text are left out. More of the real structure can be kept on request, at the cost of disclosing more about the real data. With mode = "local" (for the data owner's own use) or mode = "collaborate" (for sharing), numeric columns are simulated from a Gaussian copula, which approximately preserves each column's distribution and the correlations between them. In those modes, treatment effects can also be mimicked by setting conditional = TRUE in mask(). A folder of files or a multi-sheet workbook can be masked together. Keys shared by the tables get the same codes in every table, so the synthetic tables still join. Each run also returns a recipe, which maps the codes back to the real labels. The recipe is as confidential as the data and should stay with the data owner. apply_recipe() converts the real data into the names and codes of the copy, so code written on the copy runs on it unchanged, and unmask() converts results back to the real labels. The package gives no formal privacy guarantee.

Authors:Max Moldovan [aut, cre], Grains Research and Development Corporation [fnd, cph]

masque_0.18.0.tar.gz
masque_0.18.0.zip(r-4.7-any)masque_0.18.0.zip(r-4.6-any)masque_0.18.0.zip(r-4.5-any)
masque_0.18.0.tgz(r-4.6-any)masque_0.18.0.tgz(r-4.5-any)
masque_0.18.0.tar.gz(r-4.7-any)masque_0.18.0.tar.gz(r-4.6-any)
masque_0.18.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html✨
DESCRIPTION |NEWS
card.svg |card.png
masque/json (API)

# Install 'masque' in R:
install.packages('masque', repos = c('https://max578.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/max578/masque/issues

Pkgdown/docs site:https://max578.github.io

On CRAN:

Conda:

5.60 score 212 downloads 33 exports 7 dependencies

Last updated from:cf4a31f2ca (on main). Checks:9 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-develOK235
source / vignettesOK266
linux-releaseOK186
macos-releaseOK223
macos-oldrelOK201
windows-develOK225
windows-releaseOK226
windows-oldrelOK213
wasm-releaseOK103

Exports:apply_recipeaudit_maskclean_tableclone_planconform_tablecontrol_speccontrol_tablecontrolsdata_carddetect_designhandoverjitter_coordinatesmaskmask_setmasquemasque_planplot_design_summarypropose_rolesread_planread_reciperead_setrecipereveal_mapsrole_optionsrolesroles_validatesave_plansave_recipeset_rolesynthesise_geospatialsyntheticunmaskwrite_set

Dependencies:clidata.tabledigestlatticeMatrixS7withr

Confidentiality and the threat model
Why | What | Example | What a default clone keeps | Hiding design labels | Numeric treatments | The conditional clone: mimicking the treatment effect | Figure: the effect on each clone | What the copula keeps: monotone association only | Columns constant within a trial: the grain | Time-to-event outcomes | The leakage audit, and a refused write | Small tables | Multi-table sets | Geographic coordinates | Results | Limits | What to read next | Reproduce | References

Last update: 2026-11-25
Started: 2026-05-16

Getting started with masque
Why | What | What a default clone keeps | Opting into structure | Example | The one-call path | A clone with structure | The masking plan: roles and actions | Editing the plan as code | A plan the package refuses | More than one table | Describing the clone: the data card | Multi-environment structure | Figure: the multi-environment coverage plot | Results | Limits | What to read next | Reproduce | References

Last update: 2026-11-25
Started: 2026-05-16

Known-truth controls
Why | A clone and a declaration | The analyst's side: controls from the clone | The owner's side: the same spec on the original | Carrying the spec in a plan | What a control cannot tell you

Last update: 2026-11-25
Started: 2026-11-25

Recipe anatomy and the round-trip
Why | What | Example | What a recipe holds | Printing is redacted | The round-trip | Fail-closed translation | Saving the recipe | Multi-table bundles | Figure: original against synthetic yield | Results | Limits | What to read next | Reproduce

Last update: 2026-11-25
Started: 2026-05-16

What a conditional clone keeps of the design
Why | What | The pass rule | Example | The eight designs | Masking and measuring | The table | Figure: the F statistic per term, clone against original | Results | Limits | What to read next | Reproduce

Last update: 2026-11-25
Started: 2026-09-25

Readme and manuals

Help Manual

Help pageTopics
Translate a data frame into the synthetic namespaceapply_recipe
Audit a masque object for leakage and shareability risksaudit_mask
Tidy a dirty table's column names and category labels before maskingclean_table
The plan in clone vocabulary, for the analystclone_plan
Bring a cleaned table to an analysable format, reporting every assumptionconform_table
Declare the controls to derive from a tablecontrol_spec
Produce one control datasetcontrol_table
Derive null, negative and positive controls from a tablecontrols
Write a data card for a masked clonedata_card
Detect environment scope and experimental-design structuredetect_design
Hand a clone to an analysthandover
Coarsen geographic coordinates by an on-land privacy jitterjitter_coordinates
Make a synthetic copy of one tablemask
Mask a multi-table set with cross-table-consistent aliasingmask_set
Mask a dataset end to end with one guided callmasque
A masking plan: roles and named specs in one objectmasque_plan
Sanity-check visualisation for detected scope and designplot_design_summary
Propose role and action classifications for the columns of a data framepropose_roles
Read a masque recipe from diskread_recipe
Read a set of tables from a folder, an Excel workbook, or a listread_set
Extract the recipe from a masque objectrecipe
Reveal the level maps held inside a recipereveal_maps
List every role and action combination masque acceptsrole_options
The role table of a masked cloneroles
Validate a roles tableroles_validate
Save and read a masking plan as YAMLread_plan save_plan
Save a masque recipe to disksave_recipe
Set the role and action of one or more columns in a roles tableset_role
Re-anchor synthetic geospatial coordinates at plausible-but-fake locationssynthesise_geospatial
Extract the synthetic data from a masque objectsynthetic
Translate data from the synthetic namespace back to the originalunmask
Write a masked set to disk, mirroring the input formatwrite_set