Random Ordering for the Runs of a Design

DESCRIPTION:
Returns an integer vector giving a random permutation of the rows of the design.

USAGE:
randomize(design, restrict=NULL)

REQUIRED ARGUMENTS:
design:
a design; that is, a data frame representing factors for an experimental design.

OPTIONAL ARGUMENTS:
restrict:
vector (either numeric or character) specifying some factors (columns) in the design which shouldn't be scrambled.

VALUE:
a vector giving a random permutation of the rows of the design. If restrict is supplied, randomization will occur only within levels 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.

DETAILS:
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.

SEE ALSO:
fac.design , oa.design .

EXAMPLES:
# 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