salt: Salt a vector.

Description Usage Arguments Details Value Examples

Description

salt takes a vector .x and returns a salted version of it. The algorithm for salting a vector is:

  1. Select a random sample of characters of length .n_chars from .chars. Call this random sample .y.

  2. Concatenate .y, the vector .x, and .y again in a vectorized fashion.

Usage

1
salt(.x, .seed = NULL, .chars = letters, .n_chars = 5L)

Arguments

.x

a vector.

.seed

an integer to seed the random number generator.

.chars

set of characters to salt with.

.n_chars

an integer; number of characters to salt with.

Details

The user is advised to check out Wikipedia for more information.

Value

A salted version of the vector.

Examples

1
2
3
4
5
6
7
8
# Use various number of characters
salt(letters, .n_chars = 0L)
salt(letters, .n_chars = 1L)
salt(letters, .n_chars = 5L)
salt(letters)

# Use other sets of characters to salt with
salt(letters, .chars = letters[1:2])

paulhendricks/anonymizer documentation built on May 24, 2019, 8:27 p.m.