sdcMicro (version 4.1.0)

swappNum-deprecated: 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.

Value

  • xoriginal data
  • xmthe rank swapped data
  • methodinfo about the method name

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.

References

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

See Also

microaggregation

Examples

Run this code
## Numerical Rank Swapping:
data(free1)
free1[, 31:34] <- rankSwap(free1[, 31:34], P=10)

Run the code above in your browser using DataLab