sim_df Produces a data table with the same distributions and correlations as an existing data table Only returns numeric columns and simulates all numeric variables from a continuous normal distribution (for now).

sim_df(data, n = 100, within = c(), between = c(), id = "id",
  dv = "value", empirical = FALSE, long = FALSE, seed = NULL,
  grp_by = NULL)

Arguments

data

the existing tbl (must be in wide format)

n

the number of samples to return per group

within

a list of the within-subject columns

between

a list of the between-subject columns

id

the names of the column(s) for grouping observations

dv

the name of the DV (value) column

empirical

Should the returned data have these exact parameters? (versus be sampled from a population with these parameters)

long

whether to return the data table in long format

seed

a single value, interpreted as an integer, or NULL (see set.seed)

grp_by

(deprecated; use between)

Value

a tbl

Examples

iris100 <- sim_df(iris, 100)
#> Warning: `...` must not be empty for ungrouped data frames. #> Did you want `data = everything()`?
iris_species <- sim_df(iris, 100, between = "Species")