Function setInfo() is used to update values in
sdcProblem or problemInstance objects
Arguments
- object
an object of class
sdcProblemorproblemInstance- type
a scalar character specifying the kind of information that should be changed or modified; if
objectinherits classproblemInstance, the slots are directly changed, otherwise the values within slotproblemInstanceare updated. Valid choices are:lb: lower possible bounds for the cellub: max. upper bound for the given cellLPL: lower protection levelSPL: sliding protection levelUPL: upper protection levelsdcStatus: cell-status
- index
numeric vector defining cell-indices for which which values in a specified slot should be changed|modified
- input
numeric or character vector depending on argument
typewith its length matching the length of argumentindexcharacter vector if type matches 'sdcStatus'
a numeric vector if type matches 'lb', 'ub', 'LPL', 'SPL' or 'UPL'
Cell Status Codes
When an object of class sdcProblem is created, every cell is assigned an
internal anonymization state. These codes track the lifecycle of a
cell throughout the suppression process:
"s"("Publishable"): The cell is safe and can be published (default)."z"("Forced Publishable"): The cell must not be suppressed under any circumstances."u"(*"Primary Suppressed"): The cell is identified as sensitive and requires protection (typically assigned viaprimarySuppression())."x"("Secondary Suppressed"): The cell is suppressed to protect primary sensitive cells (typically assigned viaprotectTable())."w"("Extension Cell"): The cell exists in the object but will never be published. It is treated as a suppressed cell by internal algorithms. This is useful if it is known in advance that specific codes of a hierarchy will be excluded from publication.
Initially in makeProblem(), cells are coded as "s" or "z". Their
status transitions to "u" or "x" as suppression algorithms are applied.
While setInfo() or change_cellstatus() allow for manual state
modifications, primarySuppression() automatically identifies primary
sensitive cells and assigns state "u". In protectTable(), additional
cells are identified and set to "x" to ensure all primary sensitive
cells are adequately protected.
Author
Bernhard Meindl bernhard.meindl@statistik.gv.at
Examples
# load example-problem with suppressions
# (same as example from ?primarySuppression)
p <- sdc_testproblem(with_supps = TRUE)
# which is the overall total?
idx <- which.max(getInfo(p, "freq")); idx
#> [1] 1
# we see that the cell with idx = 1 is the overall total and its
# anonymization state of the total can be extracted as follows:
print(getInfo(p, type = "sdcStatus")[idx])
#> [1] "s"
# we want this cell to never be suppressed
p <- setInfo(p, type = "sdcStatus", index = idx, input = "z")
# we can verify this:
print(getInfo(p, type = "sdcStatus")[idx])
#> [1] "z"
# changing slot 'UPL' for all cells
inp <- data.frame(
strID = getInfo(p, "strID"),
UPL_old = getInfo(p, "UPL")
)
inp$UPL_new <- inp$UPL_old + 1
p <- setInfo(p, type = "UPL", index = 1:nrow(inp), input = inp$UPL_new)