localSupp2Wrapper {sdcMicro} | R Documentation |
A wrapper function for function localSupp2 in order to guarantee k-anonymity.
localSupp2Wrapper(x, keyVars, w, importance=rep(1, length(keyVars)), method="minimizeSupp", kAnon=2)
x |
data frame or matrix |
keyVars |
column index of key variables |
w |
column index of sampling weights |
importance |
weights for each key variable, see ‘localSupp2()’ |
method |
“minimizeSupp” (default), further methods will be included in future versions of the package |
kAnon |
parameter for k-anonymity. |
This wrapper function guarantees k-anonymity. If function localSupp2() cannot be reach k-anonymity, localSupp2 must be re-run on the previous results as long as k-anoymity is reached. If k-anoymity cannot be achieved (because the entries of parameter importance includes too much zeros) the function breaks after a sub-optimal solution is obtained.
Object from class localSupp2.
xAnon |
resulting data with suppressions |
supps |
number of suppressions in the key variables |
totalSupps |
total number of suppressions. |
anonymity |
TRUE, if k-anonymity is achieved |
keyVars |
index of the key variables. |
importance |
weight vector for key variables |
kAnon |
k for k-anoymity |
fix me: Implementation in C and interface to R.
Bernhard Meindl, Matthias Templ
## example from Capobianchi, Polettini and Lucarelli: ## same results as localSupp2 data(francdat) localSupp2Wrapper(francdat, keyVars=c(2,4,5,6), w=8) localSupp2Wrapper(francdat, keyVars=c(2,4,5,6), w=8, k=2) localSupp2Wrapper(francdat, keyVars=c(2,4,5,6), w=8, k=4) ## we want to avoid missings in column 5: l1 <- localSupp2Wrapper(francdat, keyVars=c(2,4,5,6), importance=c(1,1,0,1), w=8, kAnon=1) l1$x ## we want to avoid missings in column 5 and allow missings in 1 only if ## is really necessary: l1 <- localSupp2Wrapper(francdat, keyVars=c(2,4,5,6), importance=c(0.1,1,0,1), w=8, kAnon=1) l1$x ## long computation time, wait some seconds to get an information ## about the estimated computing time. ## l = localSupp2(free1, keyVars=1:3, w=30, k=2, importance=c(0.1,1,0.8))