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)
an object of class sdcMicroObj-class
character-vector of length 1 refering to a categorical key variable within obj
.
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
.
a modified sdcMicroObj-class
object.
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
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"))