Generates a data table with a specified within and between design. See vignette("sim_design", package = "faux") for examples and details.

sim_design(
within = list(),
between = list(),
n = 100,
mu = 0,
sd = 1,
r = 0,
empirical = FALSE,
long = FALSE,
dv = list(y = "value"),
id = list(id = "id"),
vardesc = list(),
plot = faux_options("plot"),
interactive = FALSE,
design = NULL,
rep = 1,
nested = TRUE,
seed = NULL,
sep = faux_options("sep")
)

## Arguments

within

a list of the within-subject factors

between

a list of the between-subject factors

n

the number of samples required

mu

the means of the variables

sd

the standard deviations of the variables

r

the correlations among the variables (can be a single number, full correlation matrix as a matrix or vector, or a vector of the upper right triangle of the correlation matrix

empirical

logical. If true, mu, sd and r specify the empirical not population mean, sd and covariance

long

Whether the returned tbl is in wide (default = FALSE) or long (TRUE) format

dv

the name of the dv for long plots (defaults to y)

id

the name of the id column (defaults to id)

vardesc

a list of variable descriptions having the names of the within- and between-subject factors

plot

whether to show a plot of the design

interactive

whether to run the function interactively

design

a design list including within, between, n, mu, sd, r, dv, id, and vardesc

rep

the number of data frames to return (default 1); if greater than 1, the returned data frame is nested by rep (if nested = TRUE)

nested

Whether to nest data frames by rep if rep > 1

seed

DEPRECATED use set.seed() instead before running this function

sep

separator for factor levels

a tbl