R/masque-package.R

#' masque: Structurally Faithful Development Surrogates for Tabular Data
#'
#' `masque` turns a confidential tabular dataset -- a single table, a
#' folder of files, or a multi-sheet workbook -- into a structurally
#' faithful synthetic clone suitable for pipeline development.
#' Experimental-design columns and the NA pattern are preserved exactly;
#' treatment and categorical-covariate level vocabularies are optionally
#' aliased; outcome and numeric-covariate values are re-simulated via a
#' Gaussian copula that preserves the global covariance structure. A
#' private `recipe` round-trips a pipeline written against the synthetic
#' clone onto the original data.
#'
#' @section Getting started:
#' [masque()] is the one-call front door: it reads the input, proposes a
#' per-column masking plan (a `role` and an `action` for each column;
#' see [propose_roles()] and [set_role()]), masks, audits, and optionally
#' writes the result. A single table flows through [mask()]; a folder,
#' workbook, or named list flows through [mask_set()], which aliases
#' shared keys identically across tables so the synthetic set still
#' joins. [apply_recipe()] and [unmask()] re-target a finished pipeline
#' onto the original data. [audit_mask()] grades what the clone discloses,
#' and [data_card()] describes the clone for a collaborator without
#' listing any value.
#'
#' @section Scope and limits:
#' `masque` is **not** a differential-privacy or anonymisation tool. Its outputs
#' are development surrogates: faithful enough to the structure that pipeline
#' code runs unchanged, and in collaborate mode the raw values are not
#' exposed. See `vignette("confidentiality", package = "masque")` for
#' the full threat model and limitations.
#'
#' @section Two modes:
#' - `mode = "local"`: owner's realistic dev surrogate; preserves names and
#'   level vocabularies; may emit observed values; not for external sharing.
#' - `mode = "collaborate"`: opaque aliasing for treatment and
#'   categorical-covariate levels; within-resolution jitter on numerics;
#'   whole numbers stochastically rounded; `audit_mask()` auto-runs at
#'   construction.
#'
#' @importFrom data.table :=
#' @importFrom utils str
#' @keywords internal
"_PACKAGE"

# Lets data.table's `[` see masque code as data.table-aware.
.datatable.aware <- TRUE

Try the masque package in your browser

Any scripts or data that you put into this service are public.

masque documentation built on Nov. 19, 2026, 1:06 a.m.