setInfo | R Documentation |
sdcProblem
or problemInstance
objectsFunction setInfo()
is used to update values in
sdcProblem
or problemInstance
objects
setInfo(object, type, index, input)
object |
an object of class |
type |
a scalar character specifying the kind of information that
should be changed or modified; if
|
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
|
a sdcProblem
- or problemInstance
object
Bernhard Meindl bernhard.meindl@statistik.gv.at
# 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
# 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])
# 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])
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.