Description Usage Arguments Value Examples
View source: R/key_generator.R
This function generates a unique set of alphanumeric keys that can be
assigned to a data.frame or other dataset. The code is adapted from that of
Julien Navarre in this Stack Overflow thread.
Parameters match those of the stri_rand_strings
function.
1 | key_generator(n, key_length, ...)
|
n |
Integer indicating the desired number of keys to generate. |
key_length |
Integer indicating the desired length of they key strings. |
... |
Additional arguments passed on to |
Character vector of length n
containing unique alphanumeric keys.
1 2 3 4 5 6 7 8 9 10 | key_generator(n=10, key_length = 6)
key_generator(n=5, key_length = 11)
key_generator(n=15, key_length = 3)
## Add key to data.frame
df <- data.frame(x=letters[1:10], y = 1:10)
df <- cbind(
data.frame(key = key_generator(n=nrow(df), key_length = 3)),
df)
df
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.