swappNum {sdcMicro} | R Documentation |
Rank Swapping.
swappNum(x, w = 1:(dim(x)[2]), p)
x |
matrix or data frame |
w |
variables, on which rank swapping should be applied |
p |
Percentage. Swapping range. |
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.
x |
original data |
xm |
the rank swapped data |
method |
info about the method name |
Matthias Templ
Look, e.g. on http://www.niss.org/dgii/TR/dataswap-finalrevision.pdf
## Numerical Rank Swapping: data(free1) free1[, 31:34] <- swappNum(free1[, 31:34], p=10)