addGhostVars {sdcMicro} | R Documentation |
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)
Arguments
obj |
an object of class |
keyVar |
character-vector of length 1 refering to a categorical key variable within |
ghostVars |
a character vector specifying variables that are linked to |
Value
a modified sdcMicroObj-class
object.
Author(s)
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. doi:10.1007/978-3-319-50272-4 doi:10.1007/978-3-319-50272-4
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"))