tests/testthat/test-ttable.R

# Test for ttable
test_that("ttable builds contingency table", {
  from <- c("A", "B", "A")
  to <- c("B", "A", "A")
  tab <- ttable(from, to)
  expect_equal(tab["A", "A"], 1)
  expect_equal(tab["A", "B"], 1)

  expect_error(ttable(from, to[1:2]))
})

Try the o2ools package in your browser

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

o2ools documentation built on June 8, 2025, 10:18 a.m.