randomize: Randomize a sample into groups

View source: R/statpsych1.R

randomizeR Documentation

Randomize a sample into groups

Description

Randomly assigns a sample of participants into k groups.

Usage

randomize(n)

Arguments

n

k x 1 vector of sample sizes

Value

Returns a vector of randomly generated group assignments

Examples

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
 


statpsych documentation built on Sept. 11, 2024, 7:42 p.m.