Learn R Programming

sdcMicro (version 5.6.1)

addGhostVars: addGhostVars

Description

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.

Usage

addGhostVars(obj, keyVar, ghostVars)

Value

a modified sdcMicroObj-class object.

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.

Author

Bernhard Meindl

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. tools:::Rd_expr_doi("10.1007/978-3-319-50272-4") tools:::Rd_expr_doi("10.1007/978-3-319-50272-4")

Examples

Run this code
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"))

Run the code above in your browser using DataLab