rand_names {blockr.core} | R Documentation |
Random IDs
Description
Randomly generated unique IDs are used throughout the package, created by
rand_names()
. If random strings are required that may not clash with a set
of existing values, this can be guaranteed by passing them as old_names
.
The set of allowed characters can be controlled via chars
and non-random
pre- and suffixes may be specified as prefix
/suffix
arguments, while
uniqueness is guaranteed including pre- and suffixes.
Usage
rand_names(
old_names = character(0L),
n = 1L,
length = 15L,
chars = letters,
prefix = "",
suffix = ""
)
Arguments
old_names |
Disallowed IDs |
n |
Number of IDs to generate |
length |
ID length |
chars |
Allowed characters |
prefix , suffix |
ID pre-/suffix |
Value
A character vector of length n
where each entry contains length
characters (all among chars
and start/end with prefix
/suffix
), is
guaranteed to be unique and not present among values passed as old_names
.
Examples
rand_names(chars = c(letters, LETTERS, 0:9))
rand_names(length = 5L)
rand_names(n = 5L, prefix = "pre-", suffix = "-suf")
[Package blockr.core version 0.1.0 Index]