Generate a vector of a values from a set

set_vector(size, set = NULL, set_type = NULL, set_size = NULL, ...)

Arguments

size

integer, vector length

set

vector a set of values to pick from; default: NULL

set_type

string if set is NULL generate a random set of type ("integer", "string", "boolean", "numeric"); default: NULL

set_size

integer, number of elements in random set; default: NULL

...

additional arguments for random set generator. For details check random_vector

Note

When using a random set, be aware, that set has to be unique, thus if arguments passed to generator do not allow this, the function can end up in an infinite loop.

Examples

set_vector(10, set = c("a", "b", "c"))
#>  [1] "c" "b" "a" "c" "b" "c" "c" "c" "c" "c"
set_vector(size = 5, set_type = "string", set_size = 3)
#> [1] "rPDr"           "rPDr"           "y3MPq5dLywG6Wc" "kyHLcyKSAE"    
#> [5] "y3MPq5dLywG6Wc"