# Install packages and dependencies
library(inti)
library(dplyr)
library(huito)Planning an experiment follows a reproducible routine:
inti, knitr, and dplyr packages.# Install packages and dependencies
library(inti)
library(dplyr)
library(huito)The Randomized Complete Block Design is recommended when an environmental gradient is present in the field, grouping experimental units into homogeneous blocks to control spatial variability.
# 1. Define factors: fertilization doses
factors <- list(
fertilization = c("0", "50", "100")
)
# 2. Generate RCBD layout
design <- design_repblock(
nfactors = 1,
factors = factors,
type = "rcbd",
rep = 4,
zigzag = TRUE,
seed = 2026
)
# Fieldbook preview
fb <- design$fieldbook
fb %>%
knitr::kable(caption = "Fieldbook preview")| qrcode | plots | ntreat | fertilization | sort | block | rows | cols | design |
|---|---|---|---|---|---|---|---|---|
| inkaverse_1001 | 1001 | 1 | 0 | 1 | 1 | 1 | 1 | rcbd |
| inkaverse_1002 | 1002 | 3 | 100 | 2 | 1 | 1 | 2 | rcbd |
| inkaverse_1003 | 1003 | 2 | 50 | 3 | 1 | 1 | 3 | rcbd |
| inkaverse_2001 | 2001 | 2 | 50 | 1 | 2 | 2 | 3 | rcbd |
| inkaverse_2002 | 2002 | 1 | 0 | 2 | 2 | 2 | 2 | rcbd |
| inkaverse_2003 | 2003 | 3 | 100 | 3 | 2 | 2 | 1 | rcbd |
| inkaverse_3001 | 3001 | 3 | 100 | 1 | 3 | 3 | 1 | rcbd |
| inkaverse_3002 | 3002 | 2 | 50 | 2 | 3 | 3 | 2 | rcbd |
| inkaverse_3003 | 3003 | 1 | 0 | 3 | 3 | 3 | 3 | rcbd |
| inkaverse_4001 | 4001 | 1 | 0 | 1 | 4 | 4 | 3 | rcbd |
| inkaverse_4002 | 4002 | 3 | 100 | 2 | 4 | 4 | 2 | rcbd |
| inkaverse_4003 | 4003 | 2 | 50 | 3 | 4 | 4 | 1 | rcbd |
# Field layout visualization
tarpuy_plotdesign(
data = design,
factor = "fertilization",
fill = c("plots", "ntreat")
)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.
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 <- 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 = "qrcode"
, 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 = "Fertilization"
, position = c(2.7, 1.2)
, size = 12
, font = font[2]
, opts = list(hjust = 0.0, vjust = 0.0)
, color = "black"
, prefix = "Fertilization: "
, fontface = "bold"
) %>%
include_text(value = "ntreat"
, position = c(4.5, 0.5)
, size = 12
, color = "#009966"
, font = font[2]
, prefix = "Ntreat: "
, fontface = "bold"
) %>%
include_text(value = "plots"
, position = c(9.7, 1.25)
, angle = 90
, size = 12
, color = "brown"
, font = font[3]
, prefix = "Plot: "
) 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")If you want generate the complete labels list, change: label_print(mode = "complete").
label %>%
label_print(mode = "complete"
, filename = "horizontal-DBCA-1"
, nlabels = 12)