randomize(design, restrict=NULL)
restrict
is supplied, randomization will occur only
withinlevels of the combination of the restricted factors.
The runs (rows) of the design will be ordered by the restricted factors,
and then randomly within this order.
Returns a vector of the rows of a design that have been randomly ordered.
The user can use the
restrict
argument to prevent columns from being
scrambled during the randomization.
# a 3^2 factorial, randomized within levels of the first factor mydesign <- fac.design(rep(3,2)) perm <- randomize(mydesign,"A") perm # in this case, produces the following output: [1] 4 7 1 5 2 8 6 3 mydesign[perm,] # in this case, produces the following output: A B 7 A1 B3 4 A1 B2 1 A1 B1 2 A2 B1 8 A2 B3 5 A2 B2 9 A3 B3 6 A3 B2 3 A3 B1