Apply primary suppression
Description
Function primarySuppression()
is used to identify and suppress primary
sensitive table cells in sdcProblem objects.
Argument type
allows to select a rule that should be used to identify
primary sensitive cells. At the moment it is possible to identify and
suppress sensitive table cells using the frequency-rule, the nk-dominance
rule and the p-percent rule.
Usage
primarySuppression(object, type, ...)
primarySuppression(object, type, ...)
Arguments
object |
a sdcProblem object |
type |
character vector of length 1 defining the primary suppression rule. Allowed types are:
|
... |
parameters used in the identification of primary sensitive cells. Parameters that can be modified|changed are:
|
Details
since versions >= 0.29
it is no longer possible to specify underlying
variables for dominance rules ("p"
, "pq"
or "nk"
) by index; these variables must
be set by name using argument numVarName
.
Value
a sdcProblem object
Note
the nk-dominance rule, the p-percent rule and the pq-rule can only
be applied if micro data have been used as input data to function makeProblem()
Author(s)
Bernhard Meindl [email protected]
Examples
# load micro data utils::data("microdata1", package = "sdcTable") # load problem (as it was created in the example in ?makeProblem p <- sdc_testproblem(with_supps = FALSE) # we have a look at the frequency table by gender and region xtabs(rep(1, nrow(microdata1)) ~ gender + region, data = microdata1) # 2 units contribute to cell with region=='A' and gender=='female' # --> this cell is considered sensitive according the the # freq-rule with 'maxN' equal to 2! p1 <- primarySuppression( object = p, type = "freq", maxN = 2 ) # we can also apply a p-percent rule with parameter "p" being 30 as below. # This is only possible if we are dealing with micro data and we also # have to specify the name of a numeric variable. p2 <- primarySuppression( object = p, type = "p", p = 30, numVarName = "val" ) # looking at anonymization states we see, that one cell is primary # suppressed (sdcStatus == "u") # the remaining cells are possible candidates for secondary cell # suppression (sdcStatus == "s") given the frequency rule with # parameter "maxN = 2". # # Applying the p-percent rule with parameter 'p = 30' resulted in # two primary suppressions. data.frame( p1_sdc = getInfo(p1, type = "sdcStatus"), p2_sdc = getInfo(p2, type = "sdcStatus") )
# load micro data utils::data("microdata1", package = "sdcTable") # load problem (as it was created in the example in ?makeProblem p <- sdc_testproblem(with_supps = FALSE) # we have a look at the frequency table by gender and region xtabs(rep(1, nrow(microdata1)) ~ gender + region, data = microdata1) # 2 units contribute to cell with region=='A' and gender=='female' # --> this cell is considered sensitive according the the # freq-rule with 'maxN' equal to 2! p1 <- primarySuppression( object = p, type = "freq", maxN = 2 ) # we can also apply a p-percent rule with parameter "p" being 30 as below. # This is only possible if we are dealing with micro data and we also # have to specify the name of a numeric variable. p2 <- primarySuppression( object = p, type = "p", p = 30, numVarName = "val" ) # looking at anonymization states we see, that one cell is primary # suppressed (sdcStatus == "u") # the remaining cells are possible candidates for secondary cell # suppression (sdcStatus == "s") given the frequency rule with # parameter "maxN = 2". # # Applying the p-percent rule with parameter 'p = 30' resulted in # two primary suppressions. data.frame( p1_sdc = getInfo(p1, type = "sdcStatus"), p2_sdc = getInfo(p2, type = "sdcStatus") )