tests/testthat/test-basic2x2Stats.R

test_that("basic2x2Stats returns perfect metrics for a perfect 2x2 table", {
  # fmt: skip
  stats <- caret:::basic2x2Stats(factor(0:1), factor(0:1), pos = '1', neg = '0')
  expect_equal(stats[['Sensitivity']], 1)
  expect_equal(stats[['Specificity']], 1)
  expect_equal(stats[['Pos Pred Value']], 1)
  expect_equal(stats[['Neg Pred Value']], 1)
})

Try the caret package in your browser

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

caret documentation built on Nov. 15, 2026, 9:06 a.m.