tests/testthat/test-03_calculate_tem_cohort.R

xx <- calculate_tem_cohort(df = smartStd,
                           m1 = "muac1", m2 = "muac2",
                           index = "observer", n = 10)


test_that("output is a data.frame", {
  expect_is(xx, "data.frame")
})

yy <- smartStd
yy$subject <- factor(x = yy$subject)

test_that("stop works", {
  expect_error(calculate_tem_cohort(df = yy,
                                    m1 = "subject", m2 = "muac2",
                                    index = "observer", n = 10))
  expect_error(calculate_tem_cohort(df = yy,
                                    m1 = "muac1", m2 = "subject",
                                    index = "observer", n = 10))
})
nutriverse/anthrocheckr documentation built on April 14, 2024, 8:38 p.m.