tests/testthat/test-method-function.R

rngReset()

test_that('default', {
  clusfun = function(data, ...) {
    clusters = as.data.table(data) %>%
      {.[, mean(Value) > 0, by = id]$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)
})
philips-software/latrend documentation built on Jan. 9, 2025, 4:33 p.m.