Skip to contents

This function creates new nodes to edibble graph with the name corresponding to either the intended response that will be measured or a variable to be recorded. Avoid record names staring with a "." as these are reserved for other purposes downstream.

Usage

set_rcrds(
  .edibble = NULL,
  ...,
  .name_repair = c("check_unique", "unique", "universal", "minimal"),
  .record = TRUE
)

set_rcrds_of(.edibble = NULL, ...)

Arguments

.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.

...

Name-value pair. The value should correspond to a single name of the unit defined in set_units. The name should be the name of the record variable.

.name_repair

Same as the argument in tibble::tibble().

.record

A logical value. This indicates whether to record this code step. The default is TRUE. It should remain TRUE unless this function is used as a wrapper in other code.

Value

An edibble design.

See also

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

Examples

takeout(menu_crd(t = 4, n = 10)) %>%
  set_rcrds(y = unit)
#> design("Completely Randomised Design") %>%
#>   set_units(unit = 10) %>%
#>   set_trts(trt = 4) %>%
#>   allot_trts(trt ~ unit) %>%
#>   assign_trts("random", seed = 14) %>%
#>   serve_table() 
#> 
#> # Completely Randomised Design 
#> # An edibble: 10 x 3
#>       unit    trt       y
#>    <U(10)> <T(4)> <R(10)>
#>      <chr>  <chr>   <dbl>
#>  1  unit01   trt2       o
#>  2  unit02   trt1       o
#>  3  unit03   trt1       o
#>  4  unit04   trt3       o
#>  5  unit05   trt4       o
#>  6  unit06   trt1       o
#>  7  unit07   trt3       o
#>  8  unit08   trt2       o
#>  9  unit09   trt4       o
#> 10  unit10   trt4       o

takeout(menu_crd(t = 4, n = 10)) %>%
  set_rcrds_of(unit = "y")
#> design("Completely Randomised Design") %>%
#>   set_units(unit = 10) %>%
#>   set_trts(trt = 4) %>%
#>   allot_trts(trt ~ unit) %>%
#>   assign_trts("random", seed = 877) %>%
#>   serve_table() 
#> 
#> # Completely Randomised Design 
#> # An edibble: 10 x 3
#>       unit    trt       y
#>    <U(10)> <T(4)> <R(10)>
#>      <chr>  <chr>   <dbl>
#>  1  unit01   trt1       o
#>  2  unit02   trt4       o
#>  3  unit03   trt2       o
#>  4  unit04   trt4       o
#>  5  unit05   trt3       o
#>  6  unit06   trt2       o
#>  7  unit07   trt1       o
#>  8  unit08   trt3       o
#>  9  unit09   trt3       o
#> 10  unit10   trt4       o