sdcMicro (version 4.1.0)

topBotCoding: Top and Bottom Coding

Description

Function for Top and Bottom Coding.

Usage

topBotCoding(obj, value, replacement, kind = "top",column=NULL)

Arguments

obj
vector or one-dimensional matrix or data.frame or object of class sdcMicroObj
value
limit, from where it should be top- or bottom-coded
replacement
replacement value.
kind
top or bottom
column
xxx

Value

  • Top or bottom coded data or modified sdcMicroObj.

Details

Extreme values are replaced by one value to reduce the disclosure risk.

See Also

indivRisk

Examples

Run this code
data(free1)
topBotCoding(free1[,"DEBTS"], value=9000, replacement=9100, kind="top")

## 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 <- topBotCoding(sdc, value=500000, replacement=1000, column="income")
testdataout <- extractManipData(sdc)

Run the code above in your browser using DataLab