Add between factors
add_between(.data, .by = NULL, ..., .shuffle = FALSE, .prob = NULL)
the data frame
the grouping column (groups by row if NULL)
the names and levels of the new factors
whether to assign cells randomly or in "order"
probability of each level, equal if NULL
data frame
add_random(subj = 4, item = 2) %>%
add_between("subj", condition = c("cntl", "test")) %>%
add_between("item", version = c("A", "B"))
#> # A tibble: 8 × 4
#> subj item condition version
#> <chr> <chr> <fct> <fct>
#> 1 subj1 item1 cntl A
#> 2 subj1 item2 cntl B
#> 3 subj2 item1 test A
#> 4 subj2 item2 test B
#> 5 subj3 item1 cntl A
#> 6 subj3 item2 cntl B
#> 7 subj4 item1 test A
#> 8 subj4 item2 test B