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 = 913) %>%
#> serve_table()
#>
#> # Completely Randomised Design
#> # An edibble: 50 x 2
#> unit trt
#> * <U(50)> <T(5)>
#> <chr> <chr>
#> 1 unit01 trt2
#> 2 unit02 trt3
#> 3 unit03 trt1
#> 4 unit04 trt1
#> 5 unit05 trt1
#> 6 unit06 trt3
#> 7 unit07 trt4
#> 8 unit08 trt5
#> 9 unit09 trt4
#> 10 unit10 trt4
#> # ℹ 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 = 23) %>%
#> set_trts(trt = 8) %>%
#> allot_trts(trt ~ unit) %>%
#> assign_trts("random", seed = 515) %>%
#> serve_table()
#>
#> # Completely Randomised Design
#> # An edibble: 23 x 2
#> unit trt
#> * <U(23)> <T(8)>
#> <chr> <chr>
#> 1 unit01 trt5
#> 2 unit02 trt4
#> 3 unit03 trt4
#> 4 unit04 trt3
#> 5 unit05 trt6
#> 6 unit06 trt5
#> 7 unit07 trt3
#> 8 unit08 trt2
#> 9 unit09 trt7
#> 10 unit10 trt2
#> # ℹ 13 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 Split-Plot DesignSelected Split-Unit Design
#> design("Split-Plot Design | Split-Unit Design") %>%
#> set_units(mainplot = 64,
#> subplot = nested_in(mainplot, 3)) %>%
#> set_trts(trt1 = 8,
#> trt2 = 3) %>%
#> allot_trts(trt1 ~ mainplot,
#> trt2 ~ subplot) %>%
#> assign_trts("random", seed = 506) %>%
#> serve_table()
#>
#> # Split-Plot Design | Split-Unit Design
#> # An edibble: 192 x 4
#> mainplot subplot trt1 trt2
#> * <U(64)> <U(192)> <T(8)> <T(3)>
#> <chr> <chr> <chr> <chr>
#> 1 mainplot01 subplot001 trt15 trt23
#> 2 mainplot01 subplot002 trt15 trt21
#> 3 mainplot01 subplot003 trt15 trt22
#> 4 mainplot02 subplot004 trt14 trt21
#> 5 mainplot02 subplot005 trt14 trt22
#> 6 mainplot02 subplot006 trt14 trt23
#> 7 mainplot03 subplot007 trt18 trt21
#> 8 mainplot03 subplot008 trt18 trt22
#> 9 mainplot03 subplot009 trt18 trt23
#> 10 mainplot04 subplot010 trt13 trt23
#> # ℹ 182 more rows