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 = 739) %>%
#> serve_table()
#>
#> # Completely Randomised Design
#> # An edibble: 50 x 2
#> unit trt
#> * <U(50)> <T(5)>
#> <chr> <chr>
#> 1 unit01 trt1
#> 2 unit02 trt2
#> 3 unit03 trt4
#> 4 unit04 trt1
#> 5 unit05 trt3
#> 6 unit06 trt5
#> 7 unit07 trt5
#> 8 unit08 trt2
#> 9 unit09 trt2
#> 10 unit10 trt2
#> # ℹ 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 = 17) %>%
#> set_trts(trt = 4) %>%
#> allot_trts(trt ~ unit) %>%
#> assign_trts("random", seed = 212) %>%
#> serve_table()
#>
#> # Completely Randomised Design
#> # An edibble: 17 x 2
#> unit trt
#> * <U(17)> <T(4)>
#> <chr> <chr>
#> 1 unit01 trt3
#> 2 unit02 trt4
#> 3 unit03 trt2
#> 4 unit04 trt2
#> 5 unit05 trt1
#> 6 unit06 trt1
#> 7 unit07 trt1
#> 8 unit08 trt4
#> 9 unit09 trt4
#> 10 unit10 trt3
#> 11 unit11 trt1
#> 12 unit12 trt2
#> 13 unit13 trt2
#> 14 unit14 trt3
#> 15 unit15 trt2
#> 16 unit16 trt4
#> 17 unit17 trt3
# 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 = 40,
#> subplot = nested_in(mainplot, 3)) %>%
#> set_trts(trt1 = 10,
#> trt2 = 3) %>%
#> allot_trts(trt1 ~ mainplot,
#> trt2 ~ subplot) %>%
#> assign_trts("random", seed = 783) %>%
#> serve_table()
#>
#> # Split-Plot Design | Split-Unit Design
#> # An edibble: 120 x 4
#> mainplot subplot trt1 trt2
#> * <U(40)> <U(120)> <T(10)> <T(3)>
#> <chr> <chr> <chr> <chr>
#> 1 mainplot01 subplot001 trt110 trt21
#> 2 mainplot01 subplot002 trt110 trt22
#> 3 mainplot01 subplot003 trt110 trt23
#> 4 mainplot02 subplot004 trt105 trt21
#> 5 mainplot02 subplot005 trt105 trt23
#> 6 mainplot02 subplot006 trt105 trt22
#> 7 mainplot03 subplot007 trt108 trt21
#> 8 mainplot03 subplot008 trt108 trt22
#> 9 mainplot03 subplot009 trt108 trt23
#> 10 mainplot04 subplot010 trt104 trt22
#> # ℹ 110 more rows