rr3 {poputils}R Documentation

Randomly Round A Vector of Integers to Base 3

Description

Apply the 'Random Round to Base 3' (RR3) algorithm to a vector of integers (or doubles where round(x) == x.)

Usage

rr3(x)

Arguments

x

A vector of integers (in the sense that round(x) == x.) Can be an rvec.

Details

The RR3 algorithm is used by statistical agencies to confidentialize data. Under the RR3 algorithm, an integer n is randomly rounded as follows:

RR3 has some nice properties:

Value

A randomly-rounded version of x.

Examples

x <- c(1, 5, 2, 0, -1, 3, NA)
rr3(x)

[Package poputils version 0.4.2 Index]