## distributed completely at random
data(eusilc)
sam <- draw(eusilc[, c("id", "eqIncome")], size = 20)
contaminate(sam, target = "eqIncome", epsilon = 0.05,
dots = list(mean = 5e+05, sd = 10000))
## distributed at random
require(MASS)
mu <- rep(0, 2)
Sigma <- matrix(c(1, 0.5, 0.5, 1), 2, 2)
foo <- generate(size = 10, distribution = mvrnorm,
dots = list(mu = mu, Sigma = Sigma))
contaminate(foo, "DARContControl", target = "V2",
epsilon = 0.2, fun = function(x) x * 100)
Run the code above in your browser using DataLab