Learn R Programming

sdcTable (version 0.22.4)

createArgusInput: createArgusInput

Description

create required input-files and batch-file for tau-argus given an sdcProblem-obj object

Usage

createArgusInput(obj, typ = "microdata", path = getwd(), solver = "FREE",
  method, primSuppRules = NULL, responsevar = NULL, shadowvar = NULL,
  costvar = NULL, ...)

Arguments

obj
an object of class sdcProblem-class from sdcTable
typ
(character) either microdata or tabular
path
path, into which (temporary) files will be written to (amongst them being the batch-files). For each new problem-instance, a subfolder with a random-name will be created.
solver
which solver should be used. allowed choices are
  • "FREE"
  • "CPLEX"
  • "XPRESS"
method
secondary cell suppression algorithm, possible choices include:
  • MOD: modular approach. If specified, the following arguments in ... can additionally be set:
    • MaxTimePerSubtable: number specifiying max. time (in minutes) spent for each subtable
    • SingleSingle: 0/1 (default=1)
    • SingleMultiple: 0/1 (default=1)
    • MinFreq: 0/1 (default=1)

  • GH: hypercube. If specified, the following arguments in ... can additionally be set:
    • BoundPercentage: Default percentage to proctect primary suppressed cells, default 75
    • ModelSize: are we dealing with a small (0) or large (1) model? (default=1)
    • ApplySingleton: should singletons be additionally protected? 0/1 (default=1)

  • OPT: optimal cell suppression. If specified, the following arguments in ... can additionally be set:
    • MaxComputingTime: number specifiying max. allowed computing time (in minutes)

primSuppRules
rules for primary suppression, provided as a list.
responsevar
which variable should be tabulated (defaults to frequencies). For details see tau-argus manual section 4.4.4.
shadowvar
if specified, this variable is used to apply the safety rules, defaults to responsevar. For details see tau-argus manual section 4.4.4.
costvar
if specified, this variable describes the costs of suppressing each individual cell. For details see tau-argus manual section 4.4.4.
...
allows to specify additional parameters for selected suppression-method as described above.

Value

the filepath to the batch-file

Examples

Run this code
# loading micro data from sdcTable
data("microData1", package="sdcTable")
microData1$num1 <- rnorm(mean=100, sd=25, nrow(microData1))
microData1$num2 <- round(rnorm(mean=500, sd=125, nrow(microData1)),2)
microData1$weight <- sample(10:100, nrow(microData1), replace=TRUE)

dim.region <- data.frame(
  levels=c('@','@@','@@','@@','@@'),
  codes=c('Total', 'A','B','C','D'),
  stringsAsFactors=FALSE)

dim.region_dupl <- data.frame(
  levels=c('@','@@','@@','@@@','@@','@@','@@@'),
  codes=c('Total', 'A','B','b1','C','D','d1'),
  stringsAsFactors=FALSE)

dim.gender <- data.frame(
  levels=c('@','@@','@@'),
  codes=c('Total', 'male','female'),
  stringsAsFactors=FALSE)

dimList <- list(region=dim.region, gender=dim.gender)
dimList_dupl  <- list(region=dim.region_dupl, gender=dim.gender)
dimVarInd <- c(1,2)
numVarInd <- 3:5
sampWeightInd <- 6

freqVarInd <- weightInd <- NULL

## creating an object of class \code{\link{sdcProblem-class}}
obj <- makeProblem(
  data=microData1,
  dimList=dimList,
  dimVarInd=dimVarInd,
  freqVarInd=freqVarInd,
  numVarInd=numVarInd,
  weightInd=weightInd,
  sampWeightInd=sampWeightInd)

## creating an object of class \code{\link{sdcProblem-class}} containing "duplicated" codes
obj_dupl <- makeProblem(
  data=microData1,
  dimList=dimList_dupl,
  dimVarInd=dimVarInd,
  freqVarInd=freqVarInd,
  numVarInd=numVarInd,
  weightInd=weightInd,
  sampWeightInd=sampWeightInd)

## create primary suppression rules
primSuppRules <- list()
primSuppRules[[1]] <- list(type="freq", n=5, rg=20)
primSuppRules[[2]] <- list(type="p", n=5, p=20)

## create batchInput object
bO_md1 <- createArgusInput(obj, typ="microdata", path=getwd(), solver="FREE", method="OPT",
  primSuppRules=primSuppRules, responsevar="num1")
bO_td1 <- createArgusInput(obj, typ="tabular", path=getwd(), solver="FREE", method="OPT")
bO_td2 <- createArgusInput(obj_dupl, typ="tabular", path=getwd(), solver="FREE", method="OPT")

Run the code above in your browser using DataLab