randomize | R Documentation |
Randomly assigns a sample of participants into k groups.
randomize(n)
n |
k x 1 vector of sample sizes |
Returns a vector of randomly generated group assignments
n <- c(10, 10, 5)
randomize(n)
# Should return:
# [1] 2 3 2 1 1 2 3 3 2 1 2 1 3 1 1 2 3 1 1 2 2 1 1 2 2
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.