Uses faux::sim_design()
to generate a data table with a specified within and between design.
A study list object with class scivrs_study
The id for this dataset (index or character) if a dataset with this id already exists, it will overwrite it
a list of the within-subject factors
a list of the between-subject factors
the number of samples required
the means of the variables
the standard deviations of the variables
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
logical. If true, mu, sd and r specify the empirical not population mean, sd and covariance
Whether the returned tbl is in wide (default = FALSE) or long (TRUE) format
the name of the dv for long plots (defaults to y)
the name of the id column (defaults to id)
whether to show a plot of the design
the number of data frames to return (default 1); if greater than 1, the returned data frame is nested by rep
A study object with class scivrs_study
s <- study() %>%
add_sim_data("dat", within = list(time = c("day", "night")),
between = list(pet = c("cat", "dog")),
n = 10, mu = 100, sd = 10, r = 0.5)
#> id set to dataType string
#> pet set to dataType string
#> day set to dataType float
#> night set to dataType float
s$data[[1]]$data
#> id pet day night
#> 1 S01 cat 90.64376 85.10677
#> 2 S02 cat 99.06620 105.35602
#> 3 S03 cat 68.56755 89.21780
#> 4 S04 cat 108.10670 91.79680
#> 5 S05 cat 102.82067 107.94494
#> 6 S06 cat 119.26059 100.63048
#> 7 S07 cat 86.83266 81.61253
#> 8 S08 cat 98.12111 97.59509
#> 9 S09 cat 95.17019 100.60015
#> 10 S10 cat 102.12207 92.98132
#> 11 S11 dog 99.37752 108.73115
#> 12 S12 dog 102.26081 104.02569
#> 13 S13 dog 87.48389 89.92075
#> 14 S14 dog 98.27159 114.50707
#> 15 S15 dog 115.79474 116.91512
#> 16 S16 dog 99.82609 98.48612
#> 17 S17 dog 101.44576 82.34489
#> 18 S18 dog 101.25805 98.46568
#> 19 S19 dog 94.40703 91.27257
#> 20 S20 dog 81.56570 92.23877