sdcMicro (version 4.1.0)

varToFactor: Change the a keyVariable of an object of class 'sdcMicroObj' from Numeric to Factor or from Factor to Numeric

Description

Change the scale of a variable

Usage

varToNumeric(obj, var)
varToFactor(obj, var)

Arguments

obj
object of class 'sdcMicroObj
var
name of the keyVariable to change

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 <- varToFactor(sdc, var="urbrur")

Run the code above in your browser using DataLab