swappNum {sdcMicro}R Documentation

Rank Swapping

Description

Rank Swapping.

Usage

swappNum(x, w = 1:(dim(x)[2]), p)

Arguments

x matrix or data frame
w variables, on which rank swapping should be applied
p Percentage. Swapping range.

Details

The values of a variable are ranked, then each ranked value is swapped with another ranked value randomly chosen within a restricted range, i.e. the rank of two swapped values cannot differ by more than p percente of the total number of records. The function apply the rank swapping on each variable independently.

Value

x original data
xm the rank swapped data
method info about the method name

Author(s)

Matthias Templ

References

Look, e.g. on http://www.niss.org/dgii/TR/dataswap-finalrevision.pdf

See Also

microaggregation

Examples

## Numerical Rank Swapping:
data(free1)
free1[, 31:34] <- swappNum(free1[, 31:34], p=10) 

[Package sdcMicro version 2.5.8 Index]