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

Description Usage Arguments Value Note Author(s) References Examples

View source: R/randomize.R

Description

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

Usage

1
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.

Note

Each name in blockformula must correspond to a factor of the dataframe data. The only exception is UNITS. If UNITS is used in blockformula but absent from data, a factor is added to data, with one level per row. See the examples below for the usage of UNITS in blockformula.

Author(s)

Monod, H. and Bouvier, A.

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<c3><a9>trie. INRA. Versailles.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
### 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)

planor documentation built on May 20, 2017, 1:43 a.m.

Search within the planor package
Search all R packages, documentation and source code