Function that simulates discrete, factor, or categorical variables. Is essentially a wrapper around the sample function from base R.
1 | sim_factor2(n, levels, var_level = 1, replace = TRUE, ...)
|
n |
A list of sample sizes. |
levels |
Scalar indicating the number of levels for categorical, factor, or discrete variable. Can also specify levels as a character vector. |
var_level |
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. |
replace |
TRUE/FALSE indicating whether levels should be sampled with replacement. Default is TRUE. |
... |
Additional parameters passed to the sample function. |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.