sim_cat | R Documentation |
This is a simple wrapper that creates a tibble of length 'n_obs' with a single column 'groups'. It will warn if there are fewer than three replicates per group.
sim_cat(.data = NULL, n_obs = NULL, n_groups, name = "group")
.data |
An optional dataframe. If a dataframe is supplied, simulated categorical data will be added to the dataframe. Either '.data' or 'n_obs' must be supplied. |
n_obs |
Total number of observations/rows to simulate if '.data' is not supplied. |
n_groups |
How many groups or treatments to simulate. |
name |
The column name for the grouping variable. Defaults to "group". |
To-do:
- Make this optionally create multiple categorical variables as being nested or crossed or random
a tibble
sim_covar
, sim_discr
Other multivariate normal functions:
sim_covar()
,
sim_discr()
df <- sim_cat(n_obs = 30, n_groups = 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.