sdcMicro (version 4.1.0)

groupVars: Join levels of a keyVariable in an object of class 'sdcMicroObj'

Description

Transforms the factor variable into a factors with less levels and recomputes risk.

Usage

groupVars(obj, var, before, after)

Arguments

obj
object of class 'sdcMicroObj
var
name of the keyVariable to change
before
vector of levels before
after
vector of levels after

Value

  • the modified sdcMicroObj

Examples

Run this code
## for objects of class sdcMicro:
data(testdata2)
sdc <- createSdcObj(testdata2,
  keyVars=c('urbrur','roof','walls','water','electcon','relat','sex'), 
  numVars=c('expend','income','savings'), w='sampling_weight')
sdc <- groupVars(sdc, var="urbrur", before=c(1,2), after=1)

Run the code above in your browser using DataLab