This function generates a named experimental design by supplying the selected menu named design and prints out by default
You can find the available recipes with scan_menu()
.
Arguments
- recipe
A named design object. This should be typically generated from a function with prefix
menu_
. If nothing is supplied, it will randomly select one.- show
A logical value to indicate whether the code should be shown or not. Default is TRUE.
See also
See scan_menu()
for finding the short names of the
named experimental designs.
Examples
takeout(menu_crd(n = 50, t = 5))
#> design("Completely Randomised Design") %>%
#> set_units(unit = 50) %>%
#> set_trts(trt = 5) %>%
#> allot_trts(trt ~ unit) %>%
#> assign_trts("random", seed = 931) %>%
#> serve_table()
#>
#> # Completely Randomised Design
#> # An edibble: 50 x 2
#> unit trt
#> * <unit(50)> <trt(5)>
#> 1 unit1 trt1
#> 2 unit2 trt5
#> 3 unit3 trt2
#> 4 unit4 trt5
#> 5 unit5 trt3
#> 6 unit6 trt2
#> 7 unit7 trt3
#> 8 unit8 trt2
#> 9 unit9 trt3
#> 10 unit10 trt1
#> # ℹ 40 more rows
# if you omit the design parameters then it will use the default
# (which may be random)
takeout(menu_crd())
#> design("Completely Randomised Design") %>%
#> set_units(unit = 26) %>%
#> set_trts(trt = 3) %>%
#> allot_trts(trt ~ unit) %>%
#> assign_trts("random", seed = 310) %>%
#> serve_table()
#>
#> # Completely Randomised Design
#> # An edibble: 26 x 2
#> unit trt
#> * <unit(26)> <trt(3)>
#> 1 unit1 trt3
#> 2 unit2 trt3
#> 3 unit3 trt2
#> 4 unit4 trt1
#> 5 unit5 trt1
#> 6 unit6 trt2
#> 7 unit7 trt1
#> 8 unit8 trt3
#> 9 unit9 trt1
#> 10 unit10 trt3
#> # ℹ 16 more rows
# if you don't give any short names then it will generate a random one
takeout()
#> → No name was supplied so selecting a random named experimental design...
#> → Selected Youden Square Design
#> design("Youden Square Design") %>%
#> set_units(row = 10,
#> col = 7,
#> unit = crossed_by(row, col)) %>%
#> set_trts(trt = 10) %>%
#> allot_trts(trt ~ unit) %>%
#> assign_trts("random", seed = 159) %>%
#> serve_table()
#>
#> # Youden Square Design
#> # An edibble: 70 x 4
#> row col unit trt
#> * <unit(10)> <unit(7)> <unit(70)> <trt(10)>
#> 1 row1 col1 unit1 trt5
#> 2 row2 col1 unit2 trt7
#> 3 row3 col1 unit3 trt9
#> 4 row4 col1 unit4 trt2
#> 5 row5 col1 unit5 trt6
#> 6 row6 col1 unit6 trt1
#> 7 row7 col1 unit7 trt3
#> 8 row8 col1 unit8 trt8
#> 9 row9 col1 unit9 trt4
#> 10 row10 col1 unit10 trt10
#> # ℹ 60 more rows