sim_df: Simulate an existing dataframe

Description Usage Arguments Details Value Examples

Description

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).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
sim_df(
  data,
  n = 100,
  within = c(),
  between = c(),
  id = "id",
  dv = "value",
  empirical = FALSE,
  long = FALSE,
  seed = NULL,
  missing = FALSE
)

Arguments

data

the existing tbl

n

the number of samples to return per group

within

a list of the within-subject factor columns (if long format)

between

a list of the between-subject factor 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

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

missing

simulate missing data?

Details

See vignette("sim_df", package = "faux") for details.

Value

a tbl

Examples

1
2
iris100 <- sim_df(iris, 100)
iris_species <- sim_df(iris, 100, between = "Species")

faux documentation built on Sept. 14, 2021, 1:08 a.m.