setInfo: set information of 'sdcProblem-class'- or...

Description Usage Arguments Value Author(s) Examples

Description

Function getInfo is used to query information from sdcProblem-class- or problemInstance-class objects

Usage

1
setInfo(object, type, index, input)

Arguments

object

an object of class sdcProblem-class or problemInstance-class

type

a character vector of length 1 specifying the the information that should be changed or modified, valid choices are:

  • lb: slot 'lb' of input object if it is of class problemInstance-class or slot 'lb' within slot 'problemInstance' if object is of class sdcProblem-class

  • ub: slot 'ub' of input object if it is of class problemInstance-class or slot 'ub' within slot 'problemInstance' if object is of class sdcProblem-class

  • LPL: slot 'LPL' of input object if it is of class problemInstance-class or slot 'LPL' within slot 'problemInstance' if object is of class sdcProblem-class

  • SPL: slot 'SPL' of input object if it is of class problemInstance-class or slot 'SPL' within slot 'problemInstance' if object is of class sdcProblem-class

  • UPL: slot 'UPL' of input object if it is of class problemInstance-class or slot 'UPL' within slot 'problemInstance' if object is of class sdcProblem-class

  • sdcStatus: slot 'sdcStatus' of input object if it is of class problemInstance-class or slot 'sdcStatus' within slot 'problemInstance' if object is of class sdcProblem-class

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 type with its length matching the length of argument index

  • character vector if type matches 'sdcStatus'

  • a numeric vector if type matches 'lb', 'ub', 'LPL', 'SPL' or 'UPL'

Value

a sdcProblem-class- or problemInstance-class 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
# load primary suppressed data (created in the example of \code{\link{primarySuppression}})
sp <- searchpaths()
fn <- paste(sp[grep("sdcTable", sp)], "/data/problemWithSupps.RData", sep="")
problem <- get(load(fn))

# which is the overall total?
index.tot <- which.max(getInfo(problem, 'freq'))
index.tot

# we see that the cell with index.tot==1 is the overall total and its
# anonymization state of the total can be extracted as follows:
print(getInfo(problem, type='sdcStatus')[index.tot])

# we want this cell to never be suppressed
problem <- setInfo(problem, type='sdcStatus', index=index.tot, input='z')

# we can verify this:
print(getInfo(problem, type='sdcStatus')[index.tot])

# changing slot 'UPL' for all cells
inp <- data.frame(strID=getInfo(problem,'strID'), UPL_old=getInfo(problem,'UPL'))
inp$UPL_new <- inp$UPL_old+1
problem <- setInfo(problem, type='UPL', index=1:nrow(inp), input=inp$UPL_new)

bernhard-da/sdcTable documentation built on June 10, 2019, 4:54 a.m.