split_random | R Documentation |
Adds a split to the data comparable to that made by split_by()
, but split randomly through the data. All entries in df
are assigned a level randomly.
split_random(x, nlevels = 2, seed = NA, equal_size = FALSE)
x |
A data frame containing the IV and strings, or a LexOPS_pipeline object resulting from one of |
nlevels |
An integer, specifying how many levels this random split should have (default = 2). |
seed |
An integer used to set the seed, to reproduce random splits. If |
equal_size |
Logical; should LexOPS create equal (or as close to equal as possible) numbers of candidates for each level? When |
Returns df
, with a new column (name defined by cond_col
argument) identifying which level of the randomly generated IV each string belongs to.
# 2 (syllables: few, many) by 2 (random: level 1, level 2) design
lexops |>
split_by(Syllables.CMU, 1:3 ~ 4:6) |>
split_random(nlevels = 2) |>
control_for(Length) |>
generate(n = 100)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.