Skip to contents

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 Three Factors

When evaluating three factors, four designs become available: CRD and RCBD.

Factorial Randomized Complete Block Design (RCBD)

Recommended for multi-factor trials where field spatial variability or environmental gradients require blocking to control experimental error.

# 1. Define factors: Bean genotypes, fertilization levels, and irrigation regimes
factors_rcbd_3f <- list(
  Genotype = c("Bean_01", "Bean_02"),
  Fertilization = c("0", "50"),
  Irrigation = c("Low", "Medium")
)

# 2. Generate factorial RCBD layout
rcbd_exp_3f <- design_repblock(
  nfactors = 3,
  factors = factors_rcbd_3f,
  type = "rcbd",
  rep = 4,
  zigzag = TRUE,
  seed = 2026
)

# Fieldbook preview
rcbd_exp_3f$fieldbook %>%
  head(10) %>%
  knitr::kable(caption = "Factorial RCBD Fieldbook preview")
Factorial RCBD Fieldbook preview
qrcode plots ntreat Genotype Fertilization Irrigation sort block rows cols design
inkaverse_1001 1001 2 Bean_02 0 Low 1 1 1 1 rcbd
inkaverse_1002 1002 7 Bean_01 50 Medium 2 1 1 2 rcbd
inkaverse_1003 1003 5 Bean_01 0 Medium 3 1 1 3 rcbd
inkaverse_1004 1004 6 Bean_02 0 Medium 4 1 1 4 rcbd
inkaverse_1005 1005 1 Bean_01 0 Low 5 1 1 5 rcbd
inkaverse_1006 1006 8 Bean_02 50 Medium 6 1 1 6 rcbd
inkaverse_1007 1007 3 Bean_01 50 Low 7 1 1 7 rcbd
inkaverse_1008 1008 4 Bean_02 50 Low 8 1 1 8 rcbd
inkaverse_2001 2001 7 Bean_01 50 Medium 1 2 2 8 rcbd
inkaverse_2002 2002 4 Bean_02 50 Low 2 2 2 7 rcbd

# Spatial layout visualization
tarpuy_plotdesign(
  data = rcbd_exp_3f,
  factor = "Genotype",
  fill = c("plots", "Fertilization", "Irrigation")
)

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.

# Experimental fieldbook
fb <- rcbd_exp_3f $fieldbook

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 = "Irrigation"
               , position = c(2.4, 1.2)
               , size = 12
               , font = font[2]
               , color = "black"
               , prefix = "Irrigation: "
               , fontface = "bold"
               , opts = list(hjust = 0.0, vjust = 0.0)
               ) %>%
    include_text(value = "Genotype"
               , position = c(2.4, 0.5)
               , size = 12
               , color = "#009966"
               , font = font[2]
               , prefix = "Genotype: "
               , fontface = "bold"
               , opts = list(hjust = 0.0, vjust = 0.0)
               ) %>% 
  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.

Generate the complete labels

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

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