data: A data frame containing the subjects to be randomized
sizes: a numeric vector indicating the sizes of the treatment groups. Vector must sum to the number of subjects. If not provided, subjects will be randomized into two groups of size as nearly equal as possible.
groups: a character vector giving the names of the groups. Names correspond to sizes specified in previous sizes. Length of groups must equal length of sizes.
block: Variable(s) in the data frame with respect to which blocking is performed. In order to block with respect to more than one variable at once, enter as character vector, e.g.: c("Var1","Var2").
seed: randomization seed, for reproducibility of results.
Returns
A data frame: the input frame data augmented with a variable treat.grp indicating the assignment of subjects to groups.
Examples
data(SmallExp)#small hypothetical list of subjects#completely randomized designRandomExp(SmallExp)#Block with reppect to sex:RandomExp(SmallExp,sizes=c(8,8),groups=letters[1:2],block="sex")#Block for both sex and athletic status:RandomExp(SmallExp,sizes=c(8,8),groups=letters[1:2],block=c("sex","athlete"))