# load example-problem
# (same as example from ?makeProblem)
p <- sdc_testproblem(with_supps = FALSE)
# goal: set cells with region = "D" and gender != "total" as primary sensitive
# using a data.frame as input
specs <- data.frame(
region = "D",
gender = c("male", "female", "total")
)
# marking the cells as sensitive
p <- change_cellstatus(
object = p,
specs = specs,
rule = "u"
)
# check
cell_info(p, specs = specs)
# using a named vector for a single cell to revert
# setting D/total as primary-sensitive
specs <- c(gender = "total", region = "D")
p <- change_cellstatus(
object = p,
specs = specs,
rule = "s"
)
# and check again
cell_info(p, specs = specs)
Run the code above in your browser using DataLab