Learn R Programming

planor (version 1.5-3)

planor.randomize: Randomize a Factorial Design from an Orthogonal Block Structure

Description

Randomize a factorial design according to a specified block structure formula.

Usage

planor.randomize(blockformula, data, out.order, keep.initial=FALSE)

Arguments

blockformula

the block structure formula.

data

a data frame.

out.order

a list of data factors that will be used to order the rows of the randomized design; if missing, the factors of the block formula are used.

keep.initial

if TRUE, the initial row order of the design is stored in column InitialUNITS of the returned dataframe.

Value

The input data frame after randomization.

References

Bailey, R.A. (1983) Generalized wreath products of permutation groups. Proc. London Math. Soc., 47, 69--82.

Kobilinsky A. (1989) Randomization of a cartesian block structure. Technical Report. Laboratoire de Biom<U+00E9>trie. INRA. Versailles.

Examples

Run this code
# NOT RUN {
### Block design
Design <- data.frame(block=rep(1:4,rep(2,4)),
   treatment=c("A1","B1","A2","B2","A3","B3","A4","B4"))
### No within-block randomization
planor.randomize(~block, data=Design)
### Blocks and units within blocks randomization     
planor.randomize(~block/UNITS, data=Design) 
### Row-Column design
RowColDes <- data.frame(row=rep(1:3,rep(3,3)),col=rep(1:3,3),
treatment=LETTERS[c(1:3,2,3,1,3,1,2)],
oldRow=rep(1:3,rep(3,3)),oldCol=rep(1:3,3))
planor.randomize(~row*col, data=RowColDes)
# }

Run the code above in your browser using DataLab