Function that simulates factor or categorical variables. Is essentially a wrapper around the sample function from base R.
sim_factor2(n, levels, var_level = 1, replace = TRUE, force_equal = FALSE, ...)
A list of sample sizes.
Scalar indicating the number of levels for categorical or factor variable. Can also specify levels as a character vector.
The level the variable should be simulated at. This can either be 1, 2, or 3 specifying a level 1, level 2, or level 3 variable respectively.
TRUE/FALSE indicating whether levels should be sampled with replacement. Default is TRUE.
TRUE/FALSE indicating if the sample size should be forced to be equal. Should not be used with the `replace = FALSE` argument.
Additional parameters passed to the sample function.