Description Usage Arguments Value Examples
hash()
calculates a simple 6-character hash of each
element of a character vector. This can be used for obfuscating
sensitive information. hash()
is NOT appropriate for
de-identification because (a) the algorithm is not
cryptographically secure and (b) the hash cannot be easily
reversed in a separate R session or without the original
values.
unhash()
takes a vector of keys and returns their
original values. unhash()
can only work in the same R session
as hash()
on the original data.
1 2 3 |
values |
character() of values to be hashed. |
except |
character(1) regular expression of values to be excluded from hashing (appearing in original form in the output). |
keys |
character() of keys (produced by |
hash()
returns a character vector the same length as the
input, but with values replaced by their hashed
equivalent. Internally, the package stores the hash as a key to
be used to look up the value when using unhash()
.
unhash()
returns a character vector the same llength as
the input, but with keys replaced by their original
values. Elements of key
not hashed in the current R session
are returned unchanged.
1 2 3 4 5 | month.name
keys <- hash(month.name, except = "^Ma")
keys
unhash(keys)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.