tests/testthat/setup-data.R

set.seed(1)

if (requireNamespace('ggplot2', quietly = TRUE)) {
  library(ggplot2)
}

testLongData = generateLongData(
  sizes = c(20L, 30L),
  fixed = Value ~ 1 + Assessment,
  cluster = ~ 1 + Assessment,
  random = ~ 1,
  id = 'Traj',
  data = data.frame(Assessment = seq(0, 1, by = .1)),
  fixedCoefs = c(0, 0),
  clusterCoefs = cbind(c(-2, 1), c(2, -1)),
  randomScales = cbind(.1, .1),
  noiseScales = c(.1, .1),
  clusterNames = c('A', 'B'),
  shuffle = TRUE
) %>%
  .[, .(Traj, Assessment, Value, Class)] %>%
  .[, Constant := 1] %>%
  .[, Cluster := Class] %>%
  .[, Traj := factor(Traj)] %>%
  .[]

Try the latrend package in your browser

Any scripts or data that you put into this service are public.

latrend documentation built on March 31, 2023, 5:45 p.m.