tests/testthat/test-method-function.R

rngReset()

test_that('default', {
  clusfun = function(data, ...) {
    clusters = as.data.table(data) %>%
      {.[, mean(Value) > 0, by = Traj]$V1} %>%
      factor(levels = c(F,T), labels = c('Low', 'High'))

    lcModelPartition(data = data, response = 'Value', trajectoryAssignments = clusters)
  }
  method = lcMethodFunction(response = 'Value', fun = clusfun)

  model = latrend(method, testLongData)

  expect_valid_lcModel(model)
})

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.