Skip to contents

This function adds the edges between variable nodes to specify the mapping of units to treatment. This function does not actually assign specific treatment levels onto actual units.


allot_trts(.edibble, ..., .record = TRUE)

allot_units(.edibble, ..., .record = TRUE)

  order = "random",
  seed = NULL,
  constrain = nesting_structure(.edibble)



An edibble design (edbl_design), an edibble data frame (edbl_table) or an object that contains the edibble data frame in the attribute design.


One-sided or two-sided formula. If the input is a one-sided formula then the whole treatment is applied to the specified unit.


Whether to record the step.


A character vector signifying the apportion of treatments to units. The value should be either "random", "systematic" or "systematic-random". "random" allocates the treatment randomly to units based on specified allotment with restrictions implied by unit structure. "systematic" allocates the treatment in a systematic order to units. "systematic-random" allocates the treatment in a systematic order to units but where it is not possible to divide treatments equally (as the number of units are not divisible by the number of levels of the treatment factor), then the extras are chosen randomly.


A scalar value used to set the seed so that the result is reproducible.


The nesting structure for units.


Return an edibble design.

See also


Other user-facing functions: design(), expect_rcrds(), export_design(), serve_table(), set_rcrds(), set_trts(), set_units()


design() %>%
  set_units(block = 10,
            plot = nested_in(block, 3)) %>%
  set_trts(treat = c("A", "B", "C"),
           pest = c("a", "b")) %>%
  allot_trts(treat ~ plot,
              pest ~ block)
#> An edibble design
#> ├─block (10 levels)
#> │ └─plot (30 levels)
#> ├─treat (3 levels)
#> └─pest (2 levels)
#> Allotment:
#> • treat ~ plot
#> • pest ~ block