The number of contributors is the number unique contributing 'charVar' codes.
NContributorsRule(
data,
freq,
numVar,
x,
maxN = 3,
protectZeros = FALSE,
charVar = NULL,
removeCodes = character(0),
remove0 = TRUE,
...
)
List where first element is logical vector defining primary suppressions.
The second element is data frame where nRule
is number contributors used
in rule and where nAll
is similar, but without omitting codes in removeCodes
.
Input data as a data frame
Vector of aggregate frequencies
Numerical variables. When several variables, only first is used.
Model matrix generated by parent function
Suppression threshold. Cells where the number of unique contributors
(based on charVar
) is less than or equal to maxN
are marked as primary suppressed.
Can be specified as a single numeric value, or as a named list or named vector.
When named, the value matching the charVar
name will be used.
If charVar
contains multiple variables and you want different thresholds for each,
maxN
must be a named list or vector with one value per variable.
For example: maxN = list(char1 = 3, char2 = 2)
.
Suppression parameter. Only TRUE (default) is used implemented.
Variable(s) with contributor codes. When empty, unique contributor in each row is assumed. When several variables, see details.
Codes to exclude when counting contributors.
Can be specified as a character vector (applied to all charVar
variables),
or as a named list of vectors to use different codes per variable.
When using a list, its names must match the variables in charVar
.
If charVar
is empty, codes are interpreted as row indices and converted to integers.
When set to TRUE
(default), data rows in which the first numVar
(if any) is zero
are excluded from the count of contributors.
Alternatively, remove0
can be specified as one or more variable names.
In this case, all data rows with a zero in any of the specified variables
are omitted from the contributor count.
Specifying remove0
as variable name(s) is useful for avoiding warning when there
are multiple numVar
variables.
unused parameters
When several charVar
variables, the rule is applied independently to each variable.
Primary suppression in at least one case results in primary suppression in the output.
As described in the documentation for the maxN
and removeCodes
parameters,
it is possible to specify them independently for each charVar
.