Latin square designs and its generalisations as an array
Usage
latin_square(n, randomise = TRUE)
latin_rectangle(nr, nc, nt, randomise = TRUE)
latin_array(dim, nt, randomise = TRUE)
Arguments
- n, nt
The number of treatments
- randomise
A logical value to indicate whether the treatment allocation should be randomised. The default value is
TRUE
.- nr
The number of rows
- nc
The number of columns
- dim
A vector of integers to indicate the number of elements in each dimension.
Functions
latin_square()
: Latin square designlatin_rectangle()
: Like a Latin square design but allow different number of rows and columnslatin_array()
: Returns an array where it stitches up multiple Latin square/rectangle design
Examples
latin_square(n = 3)
#> [,1] [,2] [,3]
#> [1,] 2 1 3
#> [2,] 1 3 2
#> [3,] 3 2 1
latin_rectangle(3, 3, 3)
#> [,1] [,2] [,3]
#> [1,] 2 3 1
#> [2,] 3 1 2
#> [3,] 1 2 3
latin_array(c(3, 3, 3), 3)
#> , , 1
#>
#> [,1] [,2] [,3]
#> [1,] 2 3 1
#> [2,] 1 2 3
#> [3,] 3 1 2
#>
#> , , 2
#>
#> [,1] [,2] [,3]
#> [1,] 1 2 3
#> [2,] 3 1 2
#> [3,] 2 3 1
#>
#> , , 3
#>
#> [,1] [,2] [,3]
#> [1,] 3 1 2
#> [2,] 2 3 1
#> [3,] 1 2 3
#>