Capture a logical rule the synthetic data must satisfy. Rules are enforced by
synth() via rejection sampling at the unit grain (see Details).
Usage
rule(expr, scope = c("row", "unit"), label = NULL, table = NULL)Arguments
- expr
A logical expression over the column names, e.g.
dbp <= sbp. Withscope = "row"it is evaluated across a unit's rows and must beTRUEfor every row. Withscope = "unit"it is evaluated once per unit (the columns are that unit's rows in positional order) and must returnTRUE– use this for temporal logic such asall(diff(los) >= 0). Missing (NA) results are treated as satisfied.- scope
"row"(default) or"unit".- label
Optional human-readable label; defaults to the deparsed expression.
- table
Optional table name when supplying constraints to
synth_linked().NULL(default) infers the table from the referenced column names.