Learn R Programming

sdcMicro (version 4.0.2)

topBotCoding: Top and Bottom Coding

Description

Function for Top and Bottom Coding.

Usage

topBotCoding(obj,...)#x, value, replacement, kind = "top")

Arguments

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

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=60000000, replacement=62000000, column="income")

Run the code above in your browser using DataLab