sim_cat: Simulate categorical data

View source: R/sim_multvar.R

sim_catR 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

sim_covar, sim_discr

Other multivariate normal functions: sim_covar(), sim_discr()

Examples

df <- sim_cat(n_obs = 30, n_groups = 3)

holodeck documentation built on Aug. 26, 2023, 1:07 a.m.