Two-Factors Design: CRD

Planning an experiment follows a reproducible routine:

  1. Load required libraries: Load inti, knitr, and dplyr packages.
  2. Define factor levels: Set up lists with genotypes, treatments, and management factors.
  3. Dispatch design generator: Choose between CRD, RCBD, Split-plot, or Augmented designs.
  4. Plot the field sketch: Verify spatial layouts and serpentine/zigzag sequences.
  5. Label design: Design the experimental labels to facilitate the data collection.
  6. Export to Field Book app: Generate field-ready sheets with trait parameters.
# Install packages and dependencies

library(inti)
library(dplyr)
library(huito)

Designs with Two Factors

When evaluating two factors, four designs become available: CRD, RCBD, Split-plot RCBD, and Augmented.

Factorial Completely Randomized Design (Factorial CRD)

Recommended for multi-factor experiments under homogeneous conditions, such as temperature- and salinity-controlled germination assays in growth chambers.

# 1. Define factors: Salinity levels and incubation temperatures
factors <- list(
  NaCl = c("0", "50", "100"),
  Temp = c("20", "25")
)

# 2. Generate factorial CRD layout
design <- design_repblock(
  nfactors = 2,
  factors = factors,
  type = "crd",
  rep = 4,
  zigzag = TRUE,
  seed = 2026
)

# Fieldbook preview
fb <- design$fieldbook 

fb %>% 
  knitr::kable(caption = "Fieldbook preview")
Fieldbook preview
qrcode plots ntreat NaCl Temp sort rep rows cols design
inkaverse_1001 1001 1 0 20 1 1 1 1 crd
inkaverse_1002 1002 6 100 25 2 2 1 2 crd
inkaverse_1003 1003 2 50 20 3 3 1 3 crd
inkaverse_1004 1004 6 100 25 4 1 1 4 crd
inkaverse_1005 1005 2 50 20 5 2 1 5 crd
inkaverse_1006 1006 2 50 20 6 1 1 6 crd
inkaverse_1007 1007 5 50 25 7 4 2 6 crd
inkaverse_1008 1008 1 0 20 8 3 2 5 crd
inkaverse_1009 1009 6 100 25 9 3 2 4 crd
inkaverse_1010 1010 5 50 25 10 2 2 3 crd
inkaverse_1011 1011 6 100 25 11 4 2 2 crd
inkaverse_1012 1012 5 50 25 12 1 2 1 crd
inkaverse_1013 1013 3 100 20 13 1 3 1 crd
inkaverse_1014 1014 3 100 20 14 4 3 2 crd
inkaverse_1015 1015 4 0 25 15 1 3 3 crd
inkaverse_1016 1016 1 0 20 16 2 3 4 crd
inkaverse_1017 1017 2 50 20 17 4 3 5 crd
inkaverse_1018 1018 1 0 20 18 4 3 6 crd
inkaverse_1019 1019 4 0 25 19 4 4 6 crd
inkaverse_1020 1020 4 0 25 20 2 4 5 crd
inkaverse_1021 1021 3 100 20 21 2 4 4 crd
inkaverse_1022 1022 5 50 25 22 3 4 3 crd
inkaverse_1023 1023 4 0 25 23 3 4 2 crd
inkaverse_1024 1024 3 100 20 24 3 4 1 crd

# Spatial layout visualization
tarpuy_plotdesign(
  data = design,
  factor = "NaCl",
  fill = c("plots", "Temp")
)

Label

The experimental field book generated by the design is used as the input data for label creation. Each row represents an experimental unit, allowing the automatic generation of individualized labels.

Customize the label layout

The label layout can be customized by combining text, images and QR codes. Each layer can use values from the experimental field book, allowing automatic generation of labels for every experimental plot.

Load package and import fonts.

font <- c("Permanent Marker", "Tillana", "Courgette")

huito_fonts(font)

You can find more fonts in https://fonts.google.com/

Label design

label <- fb %>%  
  label_layout(size = c(10, 2.5)
               , border_color = "blue"
               ) %>%
  include_image(
    value = "https://flavjack.github.io/inti/img/inkaverse.png"
    , size = c(2.1, 2.4)
    , position = c(1.2, 1.25)
    # , opts = list("image_scale(200)", "image_noise()")
    ) %>%
  include_barcode(
     value = "barcode"
     , size = c(2.5, 2.5)
     , position = c(8.2, 1.25)
     ) %>%
  include_text(value = "INKAVERSE"
               , position = c(4.6, 2)
               , size = 20
               , font = font[1]
               , fontface = "bold"
               , color = "red"
               ) %>%
  include_text(value = "NaCl"
               , position = c(4.5, 1.2)
               , size = 12
               , font = font[2]
               , color = "black"
               , prefix = "NaCl: "
               , fontface = "bold"
               ) %>%
    include_text(value = "Temp"
               , position = c(4.6, 0.5)
               , size = 12
               , color = "#009966"
               , font = font[2]
               , prefix = "Temperature: "
               , fontface = "bold"
               ) %>% 
  include_text(value = "plots"
               , position = c(9.7, 1.25)
               , angle = 90
               , size = 12
               , color = "brown"
               , font = font[3]
               , prefix = "Plot: "
               ) 

Label preview

The preview mode label_print(mode = "preview") generate a example of the label design from a random row of the data set.

label %>% 
  label_print(mode = "preview")

Generate the complete labels

If you want generate the complete labels list, change: label_print(mode = "complete").

label %>% 
  label_print(mode = "complete"
              , filename = "horizontal_crd_exp_2f"
              , nlabels = 12)