sim_cat {holodeck} | R Documentation |
Simulate categorical data
Description
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.
Usage
sim_cat(.data = NULL, n_obs = NULL, n_groups, name = "group")
Arguments
.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". |
Details
To-do:
- Make this optionally create multiple categorical variables as being nested or crossed or random
Value
a tibble
See Also
Other multivariate normal functions:
sim_covar()
,
sim_discr()
Examples
df <- sim_cat(n_obs = 30, n_groups = 3)
[Package holodeck version 0.2.2 Index]