A simple randomizer, provides equal probability of assignment to one of many groups

rnd_assign(x, k, seed)

Arguments

x

a Vector to assign

k

Number of groups to assign

seed

A seed for random assignment reproducibility

Value

An array with x, k assignment groups, and the seed as an attribute

Examples

require(jumble) x <- 1:100 rnd_assign(x, 2, as.integer(as.Date('2016-01-01')))
#> # A tibble: 100 x 2 #> id group #> <int> <chr> #> 1 1 a #> 2 2 b #> 3 3 b #> 4 4 b #> 5 5 b #> 6 6 b #> 7 7 a #> 8 8 b #> 9 9 b #> 10 10 a #> # … with 90 more rows