set_units {edibble} | R Documentation |
Set units used in experiment
Description
This function sets new edibble variables of class edbl_unit
. More
specifically, this means that new nodes are added to the edbl_graph
.
Usage
set_units(
.edibble = design(),
...,
.name_repair = c("check_unique", "unique", "universal", "minimal"),
.record = TRUE
)
Arguments
.edibble |
An edibble design ( |
... |
Either a name-value pair or a series of the names. |
.name_repair |
Same as the argument in |
.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.
Definition of unit
A unit, much like factor, is an over-used word but due to lack of a better word, edibble uses the word "unit" to refer to any entity, physical or otherwise, that pertain to the experiment. This function doen't explicitly distinguish between experimental or observational units, nor is a unit limited to these type of units. A unit in edibble can be a blocking factor or even a discrete time unit.
Limitations
Currently a unit should only have a discrete set of levels and you need to know the number of levels prior to setting the units.
See Also
Other user-facing functions:
allot_trts()
,
allot_units()
,
design()
,
expect_rcrds()
,
export_design()
,
serve_table()
,
set_rcrds()
,
set_trts()
Examples
# 30 rats
design() %>%
set_units(rat = 30) %>%
serve_table()
# 4 girls named "Anna", "Betty", "Carol", "Diana"
design() %>%
set_units(girl = c("Anna", "Betty", "Carol", "Diana")) %>%
serve_table()
# 3 companies, with 10 boxes each
design() %>%
set_units(company = c("A", "B", "C"),
box = nested_in(company, 10))
# 2 classes, one with 10 students, the other with 20 students
design() %>%
set_units(class = 2,
student = nested_in(class,
1 ~ 10,
2 ~ 20))
# 4 countries with 10 people from Australia & New Zealand and 20 from the rest
design() %>%
set_units(country = c("AU", "NZ", "USA", "JPN"),
person = nested_in(country,
c("AU", "NZ") ~ 10,
. ~ 20)) %>%
serve_table()