% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/FDlay.R
\name{fld_layout}
\alias{fld_layout}
\title{Field Design Layout Plot for Agricultural Experiments}
\usage{
fld_layout(
  design = "RBD",
  treatments = paste0("T", 1:5),
  A = c("A1", "A2"),
  B = c("B1", "B2", "B3"),
  blocks = 3,
  replications = 3,
  plot_length = 2,
  plot_width = 1,
  alley = 0.3,
  block_gap = 0.6,
  border = NULL,
  treatment_label_size = NULL,
  block_label_size = NULL,
  show_field_dimensions = TRUE,
  show_plot_dimensions = TRUE,
  seed = NULL
)
}
\arguments{
\item{design}{Type of design. Options include" "CRD", "RBD", "LSD", "FCRD","FRBD", "SPLIT", or "STRIP".}

\item{treatments}{Vector of treatment labels (used in CRD, RBD, LSD).}

\item{A}{Vector of Factor A levels (for factorial, split, strip designs).}

\item{B}{Vector of Factor B levels (for factorial, split, strip designs).}

\item{blocks}{Number of blocks (required for RBD, SPLIT, STRIP).}

\item{replications}{Number of replications. Can be a single number (equal replication) or a vector (unequal replication, e.g., c(2,3,4,2)).}

\item{plot_length}{Length of each plot}

\item{plot_width}{Width of each plot}

\item{alley}{Spacing between adjacent plots.}

\item{block_gap}{Gap between blocks.}

\item{border}{Border area around the field layout.}

\item{treatment_label_size}{Size of treatment labels in the layout}

\item{block_label_size}{Size of block labels}

\item{show_field_dimensions}{Logical; display field dimensions}

\item{show_plot_dimensions}{Logical; display plot dimensions}

\item{seed}{Random seed for reproducibility. Optional random seed to ensure reproducibility of randomization; same seed gives the same layout/results across runs.}
}
\value{
A list containing:
\describe{
\item{plot}{A ggplot object showing field layout}
\item{layout}{Data frame containing plot arrangement}
}
}
\description{
Generates randomized field layouts for agricultural experimental designs including Completely Randomized Design (CRD), Randomized Block Design (RBD),
and Latin Square Design (LSD), factorial designs, split-plot, and strip-plot.
}
\details{
This function supports:
\itemize{
\item Completely Randomized Design (CRD)
\item Randomized Block Design (RBD)
\item Latin Square Design (LSD)
\item Factorial CRD and RBD (FCRD, FRBD)
\item Split-plot and strip-plot designs
\item Unequal and equal replication structures in CRD
\item Custom plot dimensions and spacing
}
}
\examples{
layout_crd <- fld_layout(
    design = "CRD",
    treatments = paste0("T", 1:7),
    replications = c(2,3,4,2,1,5,4),
    plot_length = 2.5,
  plot_width = 1.8,
  alley = 0.3,
  border = 1.5,
  seed = 123
  )
  layout_crd$plot


# RBD example
layout_rbd <- fld_layout(
  design = "RBD",
  treatments = paste0("T",1:7),
  blocks = 4,
  seed = 123
)
layout_rbd$plot

layout_rbd <- fld_layout(
  design = "RBD",
  treatments = paste0("T",1:7),
  blocks = 4,
   treatment_label_size = 4,
   block_label_size = 3,
  show_field_dimensions = FALSE,
  show_plot_dimensions = FALSE,
  seed = 123
)
layout_rbd$plot

# Latin Square Design
layout_lsd <- fld_layout(
  design = "LSD",
  treatments = paste0("T", 1:6),
  seed = 123
)
layout_lsd$plot

# Factorial CRD
result <- fld_layout(
  design = "FCRD",
  A = c("A1", "A2", "A3"),
  B = c("B1", "B2", "B3", "B4"),
  replications = 3,
  seed = 101
)
result$plot

# Split plot
result2 <- fld_layout(
  design = "SPLIT",
  A = c("A1", "A2", "A3"),
  B = c("B1", "B2", "B3", "B4"),
  blocks = 3,
  seed = 101 )
result2$plot

}
