randomize(design, restrict=NULL)
# 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