specify variables that are linked to a key variable. This results in all suppressions of the key-variable being also applied on the corresponding 'ghost'-variables.

addGhostVars(obj, keyVar, ghostVars)

Arguments

obj

an object of class sdcMicroObj-class

keyVar

character-vector of length 1 refering to a categorical key variable within obj.

ghostVars

a character vector specifying variables that are linked to keyVar. Variables listed here must not be be listed in either slots @keyVars, @numVars, @pramVars, @weightVar, @hhId or @strataVar in obj.

Value

a modified sdcMicroObj-class object.

References

Templ, M. Statistical Disclosure Control for Microdata: Methods and Applications in R. Springer International Publishing, 287 pages, 2017. ISBN 978-3-319-50272-4. doi:10.1007/978-3-319-50272-4 doi:10.1007/978-3-319-50272-4

Author

Bernhard Meindl

Examples

data(testdata2)
sdc <- createSdcObj(testdata2,
  keyVars=c('urbrur','roof','walls','water','electcon','relat','sex'),
  numVars=c('expend','income','savings'), w='sampling_weight')
## we want to link the anonymization status of key variabe 'urbrur' to 'hhcivil'
sdc <- addGhostVars(sdc, keyVar="urbrur", ghostVars=c("hhcivil"))
## we want to link the anonymization status of key variabe 'roof' to 'represent'
sdc <- addGhostVars(sdc, keyVar="roof", ghostVars=c("represent"))