tests/testthat/test-cindex.R

# Errors
test_that("An error throws for entering an unselectable option", {
  expect_error(cindex(prostate.dat$PSA, prostate.dat$EVENT_DOD, type = "linear"))
})
test_that("An error throws for having inputs of unequal length", {
  expect_error(cindex(prostate.dat$PSA, prostate.dat$EVENT_DOD[-1]))
})
test_that("An error throws for having inputs of unequal length (survival/crr mode)", {
  expect_error(cindex(prostate.dat$PSA, prostate.dat$EVENT_DOD, prostate.dat$TIME_EVENT[-1]))
})
test_that("An error is thrown for specifying invalid event code", {
  expect_error(cindex(prostate.dat$PSA, prostate.dat$EVENT_DOD, prostate.dat$TIME_EVENT, failcode = 10))
})

Try the QHScrnomo package in your browser

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

QHScrnomo documentation built on May 29, 2024, 9:21 a.m.