Learn R Programming

FielDHub (version 1.4.2)

latin_square: Generates a Latin Square Design

Description

Randomly generates a latin square design of up 10 treatments.

Usage

latin_square(
  t = NULL,
  reps = 1,
  plotNumber = 101,
  planter = "serpentine",
  seed = NULL,
  locationNames = NULL,
  data = NULL
)

Value

A list with information on the design parameters.

Data frame with the latin square field book.

A list with two elements.

  • infoDesign is a list with information on the design parameters.

  • fieldBook is a data frame with the latin square field book.

Arguments

t

Number of treatments.

reps

Number of full resolvable squares. By default reps = 1.

plotNumber

Starting plot number. By default plotNumber = 101.

planter

Option for serpentine or cartesian arrangement. By default planter = 'serpentine'.

seed

(optional) Real number that specifies the starting seed to obtain reproducible designs.

locationNames

(optional) Name for the location.

data

(optional) Data frame with label list of treatments.

Author

Didier Murillo [aut], Salvador Gezan [aut], Ana Heilman [ctb], Thomas Walk [ctb], Johan Aparicio [ctb], Thiago de Paula Oliveira[ctb] Richard Horsley [ctb]

References

Federer, W. T. (1955). Experimental Design. Theory and Application. New York, USA. The Macmillan Company.

Examples

Run this code
# Example 1: Generates a latin square design with 4 treatments and 2 reps.
latinSq1 <- latin_square(t = 4,
                         reps = 2,
                         plotNumber = 101,
                         planter = "cartesian",
                         seed = 1980)
print(latinSq1)
summary(latinSq1)
head(latinSq1$fieldBook)

# Example 2: Generates a latin square design with 5 treatments and 3 reps.
latin_data <- data.frame(list(ROW = paste("Period", 1:5, sep = ""),
                              COLUMN = paste("Cow", 1:5, sep = ""),
                              TREATMENT = paste("Diet", 1:5, sep = "")))
print(latin_data)
latinSq2 <- latin_square(t = NULL,
                         reps = 3,
                         plotNumber = 101,
                         planter = "cartesian",
                         seed = 1981,
                         data = latin_data)
latinSq2$squares
latinSq2$plotSquares
head(latinSq2$fieldBook)

Run the code above in your browser using DataLab