Learn R Programming

randomizationInference (version 1.0.1)

latinRand: Permutations of Treatment Assignments for Latin Square Designs

Description

Randomly permutes an assignment vector or matrix according to a Latin square design, for a specified number of permutations.

Usage

latinRand(w, nperm, row, col)

Arguments

w
a vector or matrix of assignments.
nperm
a number specifying the desired number of random permutations.
row
a vector of row designations.
col
a vector of column designations.

Value

  • A list of permuted assignment vectors or matrices.

Details

Assignments are permuted such that the Latin square design is preserved. If w is a matrix, the permutations occur by row.

See Also

completeRand, blockRand

Examples

Run this code
w = c("C","D","B","A","A","B","D","C","D","C","A","B","B","A","C","D")
row = rep(1:4,4)
col = c(rep(1,4),rep(2,4),rep(3,4),rep(4,4))
latinRand(w, nperm = 5, row, col)

Run the code above in your browser using DataLab