change_cellstatus: Change anonymization status of a specific cell

Description Usage Arguments Value Author(s) Examples

View source: R/change_cellstatus.R

Description

Function changeCellStatus() allows to change|modify the anonymization state of single table cells for objects of class sdcProblem.

Usage

1
change_cellstatus(object, specs, rule, verbose = FALSE, ...)

Arguments

object

an object of class sdcProblem

specs

input that defines which cells to query; the function expects either (see examples below)

  • a named character vector: with names referring to the names of the dimensional variables and the values to its labels. In this case each vector-element must contain a single value (label)

  • a data.frame where the column-names refer to the names of the dimensional variables and the values to the labels

rule

scalar character vector specifying a valid anonymization code ('u', 'z', 'x', 's') to which all the desired cells under consideration should be set.

verbose

scalar logical value defining verbosity, defaults to FALSE

...

additional parameters for potential future use, currently unused.

Value

a sdcProblem object

Author(s)

Bernhard Meindl bernhard.meindl@statistik.gv.at

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# 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)

sdcTable documentation built on Sept. 30, 2021, 5:10 p.m.