Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
f541829
fix: console output via messages and vignette options reset (CRAN rev…
max578 Oct 29, 2026
1d80090
fix: collaborate mode keeps whole-valued and two-valued numeric colum…
max578 Oct 29, 2026
12ead24
feat: mask(events =) for linked time-to-event outcomes
max578 Oct 29, 2026
2e5f5a6
fix: set layer cleans before proposing and records each table's cleaning
max578 Oct 30, 2026
7c33ec2
fix: apply_recipe keeps linked keys the roles mark drop
max578 Oct 30, 2026
86b145f
fix: coords accepts a bare single pair; an explicit non-keep action o…
max578 Oct 30, 2026
1617fa4
fix: a shifted conditional clone keeps whole-valued doubles whole
max578 Oct 30, 2026
429307c
fix: redact print, format, str and knit_print on every recipe-holding…
max578 Oct 30, 2026
824dacc
fix: refuse a collaborate clone below five rows when a column is re-s…
max578 Oct 30, 2026
b4646b0
fix: save, read, reveal and audit a recipe bundle and a masque_set
max578 Oct 30, 2026
f677189
fix: cap a linked event's final time at the pattern's longest follow-up
max578 Oct 30, 2026
b965d88
fix: classed refusals for a non-masque accessor input, a non-.rds rec…
max578 Oct 30, 2026
c485951
perf: group on the NA matrix for the audit's NA-pattern share
max578 Oct 30, 2026
20816eb
fix(detect): take block columns from the environments once scope reso…
max578 Oct 30, 2026
e4b89c4
fix: conform decisions go on the recipe and apply_recipe replays them
max578 Oct 30, 2026
bbdb939
fix: coded labels are not near-duplicates; cap the report and record
max578 Oct 30, 2026
b2fa1d8
fix(detect): structural treatment hints need design evidence (F18, N5)
max578 Oct 30, 2026
afec00d
feat: synthesise unit-constant columns once per design unit (grain = …
max578 Oct 30, 2026
9dba218
docs: several published coordinate jitters of one point average towar…
max578 Oct 30, 2026
504cdc3
docs(detect): state the treatment-hint rule positively; shorter comments
max578 Oct 30, 2026
e3540e2
fix(roles): name the remedy for a numeric environment or design colum…
max578 Oct 30, 2026
9091644
fix: grain covers per-unit date columns and never uses a dropped desi…
max578 Oct 30, 2026
6041b23
style: wrap four lines past 80 characters
max578 Oct 30, 2026
54674b3
test: a lone design column is no longer a kept treatment (F18 follow-up)
max578 Oct 30, 2026
d0eead0
fix: front door inherits the plan's mode, forwards arguments, sets in…
max578 Oct 30, 2026
7be67f9
docs: plainer wording for info, dots and three internal comments
max578 Oct 30, 2026
f8049f1
docs: document the internal .cleaning argument of mask()
max578 Oct 30, 2026
3a86f28
docs: say what mask() keeps from a conformance object
max578 Oct 30, 2026
e1a7c89
refactor: near-duplicate case pairs without a second full label matrix
max578 Oct 30, 2026
d3419a3
feat: grade the audit on excess over a permutation baseline, per colu…
max578 Oct 30, 2026
13b5714
style: one- and two-line comments on the audit helpers
max578 Oct 30, 2026
c408e25
test: expect the ladder and all-keep warnings in the audit fixtures b…
max578 Oct 30, 2026
b82fa56
merge: fix/0160-roundtrip (F1 F2 F3 F8 F16 F17 F21 F22)
max578 Oct 30, 2026
2033de2
merge: fix/0160-surface (F10 F14 N1 F15 F19 F20-audit F22)
max578 Oct 30, 2026
230d462
merge: fix/0160-engine (F4 F5 F7 F12 F20-refusal N3 N4)
max578 Oct 30, 2026
4af6648
merge: fix/0160-detector (F6 F18 N5 F22-env)
max578 Oct 30, 2026
6e966bb
docs: regenerate Rd after merging the four 0.16.0 fix branches
max578 Oct 30, 2026
a47e92d
test: fixtures clear the five-row floor and no longer align covariate…
max578 Oct 30, 2026
c6d3308
feat: make the namespace data.table-aware package-wide
max578 Oct 30, 2026
fe72d40
feat(roles): a numeric treatment can be aliased or permuted
max578 Oct 30, 2026
0ac6ec8
feat: roles() accessor and data_card() for the C8 v0.1 card (F11, F9,…
max578 Oct 30, 2026
27d7347
docs: data card section in the getting-started vignette
max578 Oct 30, 2026
d6ff747
fix: read 0.16.0 recipe properties safely and print them redacted
max578 Oct 30, 2026
6b914a5
style: one-line comments in the numeric treatment change
max578 Oct 30, 2026
cd172fa
fix(jitter): collaborate jitter no longer clips onto the real extremes
max578 Oct 30, 2026
7300489
feat(audit): kept outcome is HIGH in collaborate; grain columns grade…
max578 Oct 30, 2026
f16be39
feat: mask_set() and masque() pass grain to every table
max578 Oct 30, 2026
69c82a7
feat: propose_roles() notes columns mask() will synthesise per unit
max578 Oct 30, 2026
f32a0bb
fix: seeded link maps, seed checks, literal cli labels, classed all-k…
max578 Oct 30, 2026
787ce44
style: one-line comments in events.R, grain.R and the recipe grain pr…
max578 Oct 30, 2026
072d4fb
merge: fix/0160-integ (data.table package-wide, 0.15.0 recipe guards,…
max578 Oct 30, 2026
aaa335c
merge: fix/0160-rules (numeric treatment alias, no jitter clip, kept …
max578 Oct 30, 2026
047eca4
merge: fix/0160-card (data_card, roles)
max578 Oct 30, 2026
54289fe
docs: document data_card and roles, five-row mask_set example with al…
max578 Oct 30, 2026
a5522a0
feat(audit): per-column HIGH for a leaky grained or whole-valued column
max578 Oct 30, 2026
a88c9f9
fix: give the last six unclassed warnings a masque_ class
max578 Oct 30, 2026
ae75cec
style: comment blocks cut to one line (prose guard)
max578 Oct 30, 2026
8b06884
fix(mask_set): link maps draw from their own sub-stream of seed
max578 Oct 30, 2026
bf8603a
docs: 0.16.0 NEWS, version, vignettes, README, API stability and resu…
max578 Oct 30, 2026
f7c3089
docs: plainer audit line in NEWS
max578 Oct 30, 2026
b83ae40
merge: fix/0160-last (calibrated per-column HIGH, classed warnings, l…
max578 Oct 30, 2026
4ad2d39
fix: replication tile skips with a warning when no block column exists
max578 Oct 30, 2026
b1ae672
merge: fix/0160-docs (NEWS 0.16.0, vignettes, cran-comments)
max578 Oct 30, 2026
b75aec5
docs: NEWS lines for the calibrated audit rule, count grading, warnin…
max578 Oct 30, 2026
a0a802c
fix: reveal_maps() prints through cli, so suppressMessages() silences it
max578 Oct 30, 2026
ca8f599
fix: import utils::str so the namespace loads with only base attached
max578 Oct 30, 2026
fe07ef3
fix: import data.table's := for the merge helpers
max578 Oct 30, 2026
ce71974
test: hash clones at 10 significant digits so the pinned digests hold…
max578 Oct 30, 2026
cca53c4
fix: refuse a declared coordinate whose proposed action is not keep (N3)
max578 Oct 30, 2026
3188970
test: check grain-free clones portably; run base digests only on macO…
max578 Oct 30, 2026
08fa3c9
docs: NEWS 0.16.0 to one screen, with the F6 block fix and strict N3
max578 Oct 30, 2026
0182179
docs: point the r-universe badge at its final URL
max578 Oct 30, 2026
6879fc1
docs: cran-comments lists the GitHub Actions platforms
max578 Oct 30, 2026
d84b35f
docs: cran-comments lists the R-hub platforms
max578 Oct 30, 2026
84ed3af
docs: cran-comments lists the win-builder run
max578 Oct 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions API_STABILITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,23 @@ existing signatures. The track record so far:
`data.table` instead of a tibble, and tibble leaves the dependencies.
Signatures and values are unchanged. **Breaking change for code that
relies on tibble behaviour, listed first in `NEWS.md`.**
- `0.16.0`: new exports `data_card()` and `roles()`. New arguments, each
with a default:
- `mask()`: `events`, `grain`, `allow_kept_outcome`
- `mask_set()`: `grain`, `allow_kept_outcome`, `sheets`, `info`, `...`
- `masque()`: `detect`, `sheets`, `info`, `...`
- `reveal_maps()`: `table`

In `mask()` the new arguments sit before `allow_unmasked_coords` and
`quiet`, and in `mask_set()` before `quiet`, so a call that passes those
by position must name them.

Default clones change for tables with a column constant within a design
unit (`grain = FALSE` restores 0.15.0), for collaborate jitter (no longer
clipped to the observed range), for numeric treatments (aliased in
collaborate mode) and for `mask_set()` link aliases made with a seed. A
kept outcome audits HIGH in collaborate mode. Recipes saved by 0.15.0
still load and apply. **Behaviour changes, listed first in `NEWS.md`.**

Additive by intent is not frozen: before 1.0 a release may break an
existing signature when a design flaw surfaces, but every such change must
Expand Down
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ authors:
repository-code: "https://github.com/max578/masque"
url: "https://max578.github.io/masque/"
license: MIT
version: 0.15.0
version: 0.16.0
keywords:
- synthetic-data
- data-masking
Expand Down
7 changes: 4 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: masque
Title: Structurally Faithful Development Surrogates for Tabular Data
Version: 0.15.0
Version: 0.16.0
Authors@R: c(
person("Max", "Moldovan",
email = "max.moldovan@gmail.com",
Expand Down Expand Up @@ -28,7 +28,7 @@ Depends:
R (>= 4.2.0)
Imports:
cli,
data.table,
data.table (>= 1.15.0),
digest,
Matrix,
S7,
Expand All @@ -46,7 +46,8 @@ Suggests:
rmarkdown,
spelling,
testthat (>= 3.0.0),
writexl
writexl,
yaml
VignetteBuilder: knitr
Config/testthat/edition: 3
URL: https://max578.github.io/masque/, https://github.com/max578/masque
Expand Down
4 changes: 4 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export(apply_recipe)
export(audit_mask)
export(clean_table)
export(conform_table)
export(data_card)
export(detect_design)
export(jitter_coordinates)
export(mask)
Expand All @@ -18,10 +19,13 @@ export(read_set)
export(recipe)
export(reveal_maps)
export(role_options)
export(roles)
export(roles_validate)
export(save_recipe)
export(set_role)
export(synthesise_geospatial)
export(synthetic)
export(unmask)
export(write_set)
importFrom(data.table,":=")
importFrom(utils,str)
73 changes: 73 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,76 @@
# masque 0.16.0

## Behaviour changes

* `mask()` synthesises a column that is constant within a design unit (a
trial-level rainfall, a site soil type) once per unit, so the clone keeps
one value per trial. `grain = FALSE` restores the row-by-row clone. In
collaborate mode, fewer than five units fall back to row-by-row with a
`masque_grain_small_units` warning.
* Collaborate mode no longer clips jittered numbers to the observed range,
which copied the real extremes into the clone.
* A numeric treatment (a dose, an N rate) can be aliased or permuted, and
collaborate mode aliases it by default; `unmask()` restores the values.
* In collaborate mode a kept outcome audits HIGH and blocks the package
writers unless `allow_kept_outcome = TRUE`, which the recipe records.
A collaborate clone of fewer than five rows is refused.
* A coordinate declared in `coords` must have the action `keep` in `roles`.
Any other action, including the `drop` that `propose_roles()` proposes,
is refused (`masque_coords_action_refusal`) instead of being overridden.
* `propose_roles()` proposes a treatment only when it is crossed with the
design, `yield`-like names as outcomes, and `Site Name`-like names as
design.
* New arguments of `mask()` and `mask_set()` come before `quiet`; pass
`quiet` and `allow_unmasked_coords` by name.
* `mask_set()` link aliases follow `seed` from their own stream, so a seeded
set from 0.15.0 gets different link aliases when made again.
* masque needs data.table 1.15.0 or later.

## New features

* `data_card()` describes a clone or a set: size, design, and per-column
counts marked exact or re-simulated. It never lists a level label.
`roles()` returns a clone's role table under the clone's column names.
* `mask()` gains `events`: linked time-to-event outcomes keep their order,
the exact count of each status pattern, and no time past the longest
observed follow-up.
* `mask_set()` and `masque()` gain `sheets` and `info` (documentation
sheets set aside, not masked). `masque()` takes `detect` and passes other
arguments on to `mask()` or `mask_set()`, refusing any they do not take.
* `audit_mask()` grades each column on its excess over chance and adds
whole-row and rare-combination checks in `attr(audit, "joint")`. A
per-unit column is HIGH when its unit values are the real ones, even moved
between units. With 5 to 8 units and few distinct values a copy cannot be
told from chance, and grades low.
* `save_recipe()`, `read_recipe()`, `reveal_maps(table = )` and
`audit_mask()` accept a `mask_set()` result. The recipe records
`conform_table()` decisions, and `apply_recipe()` replays them.
* Every warning carries a `masque_` class.

## Bug fixes

* `print()`, `format()`, `str()` and knitr output of recipes and clones no
longer show the seed or the label maps.
* `masque()` used local mode with a collaborate plan and returned real
labels; it now follows the plan's mode.
* `conform_table(merge_labels = "auto")` no longer merges codes that differ
in a run of digits (`G002`, `G011`), and prints labels as text instead of
evaluating braces in them.
* `detect_design()` no longer names an environment column (a year) as the
block of a multi-environment trial.
* Guided `masque()` no longer stops on a folder or workbook whose column
names need repair, and `apply_recipe()` keeps a linked key marked `drop`.
* Whole-numbered columns stay whole in conditional and collaborate clones,
and two-valued columns are no longer jittered.
* `apply_recipe()` maps an aliased numeric column instead of passing real
values through.
* Duplicate input column names are refused. The near-duplicate report
prints at most 20 pairs. `save_recipe()` accepts only `.rds`; a seed must
be one whole number.
* Recipes saved by 0.15.0 still print, apply, unmask and audit.
* Console output of the guided review is written as messages, and the
vignettes restore the `options()` they set.

# masque 0.15.0

## Breaking changes
Expand Down
26 changes: 23 additions & 3 deletions R/alias_levels.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#' Collaborate-mode opaque aliasing of categorical levels
#'
#' Replaces the level vocabulary with opaque aliases of the form
#' `<prefix>_001`, `<prefix>_002`, ..., assigned to the levels by a
#' `<prefix>001`, `<prefix>002`, ... (`trt_001`, `site_D001`), assigned to the levels by a

Check warning on line 4 in R/alias_levels.R

View workflow job for this annotation

GitHub Actions / lint

file=R/alias_levels.R,line=4,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 90 characters.
#' **random permutation** drawn from the RNG stream `mask()` has already
#' seeded. The alias vocabulary itself is fixed and sorted; which level
#' receives which alias is not.
Expand Down Expand Up @@ -35,7 +35,10 @@
#' exposure can be checked. This is a re-identification
#' cost, not a differential-privacy guarantee.
#'
#' @param x A factor, character, or logical vector.
#' A numeric vector (a dose, an N rate) is aliased through its exact
#' character form, so the map restores every value.
#'
#' @param x A factor, character, logical, or numeric vector.
#' @param prefix Character scalar used as the alias prefix (e.g., `"trt"`
#' for treatment, `"<col>_L"` for covariate level).
#' @return A list with elements:
Expand All @@ -62,6 +65,9 @@
out <- factor(unname(map[as.character(x)]), levels = alias_pool)
return(list(x = out, map = map))
}
if (is.numeric(x)) {
x <- .level_key(x)
}
if (is.character(x) || is.logical(x)) {
x_chr <- as.character(x)
uvals <- sort(unique(stats::na.omit(x_chr)))
Expand All @@ -76,7 +82,7 @@

cli::cli_abort(
paste0(
"alias_levels() supports factor, character, or logical; ",
"alias_levels() supports factor, character, logical, or numeric; ",
"got {.cls {class(x)[1]}}."
)
)
Expand Down Expand Up @@ -105,3 +111,17 @@
is_aliasable_level_vector <- function(x) {
is.factor(x) || is.character(x) || is.logical(x)
}

# Exact character key of numeric values: the first form that reads back.
.level_key <- function(x) {
if (!is.numeric(x)) {
return(as.character(x))
}
key <- as.character(x)
for (fmt in c("%.16g", "%.17g", "%a")) {
inexact <- !is.na(x) & suppressWarnings(as.numeric(key)) != x
if (!any(inexact)) break
key[inexact] <- sprintf(fmt, x[inexact])
}
key
}
Loading
Loading