EDGAR stands for Experimental Design Generator and Randomiser. It was
originally developed as a suite of Excel workbooks by the Biometrics
team at Rothamsted Research. The same algorithms were re-implemented in
the open-source Python project rotsl/edgar, distributed as
edgar-design on PyPI. This R package is a native R port of
that Python implementation. Python is not required at runtime.
Once the package is available on CRAN, install it with:
For development, you can install from a local checkout with:
Use generate_design(type, ..., seed = 0L) with one of
the nine design keys: cr_eq, cr_uneq,
rcb, rcb_uneq, two_factor_rcb,
latin, split_plot,
variable_blocks, alpha.
Each design is also available via a design-specific convenience function:
The package ports CPython’s Mersenne Twister seeding algorithm and
Fisher-Yates shuffle to native R. The same integer seed produces the
same design in R and in the upstream Python edgar-design
package. Generating a design never modifies the global
.Random.seed, so unrelated user code that uses
sample() or runif() is not affected.
# Run twice with the same seed; the output is identical
res1 <- generate_design("rcb", treatment_count = 4, block_count = 3, seed = 42)
res2 <- generate_design("rcb", treatment_count = 4, block_count = 3, seed = 42)
identical(as.data.frame(res1), as.data.frame(res2))
#> [1] TRUE
# Different seeds produce different designs (with overwhelming probability)
res3 <- generate_design("rcb", treatment_count = 4, block_count = 3, seed = 43)
identical(as.data.frame(res1)$Variety, as.data.frame(res3)$Variety)
#> [1] FALSEEvery design returns an edgar_design S3 object. You
can:
data.frame,$design_name,
$parameters, $seed, $warnings,
$generated_at,$layout,
$layout_headers, $layout_section_labels, or
via as_layout_frames().CSV export uses no extra dependencies:
JSON export requires the jsonlite package (in
Suggests):
XLSX export requires the openxlsx package (in
Suggests):
EDGAR was originally developed by the Biometrics team at Rothamsted
Research as Excel workbooks, available at edgarweb.org.uk. The
algorithms were subsequently re-implemented in Python by the
rotsl/edgar project, distributed as
edgar-design on PyPI. This R package is a native R port of
that Python implementation, with byte-identical cross-language
reproducibility for the same integer seed. Alpha designs follow the
methodology described by Patterson and Williams (1976).