tests/testthat/test-impute_censored.R

test_that("impute_censored() replaces censored values with predictions.", {
  x <- tibble::tibble(
    y = rnorm(100),
    .prediction = 10 * y,
    cens = sample(c("left", "right"), length(y), replace = TRUE)
  )
  input <- dplyr::select(x, y, cens)
  imp <- impute_censored(x, input, "y", "cens")
  expect_equal(imp$y, x$.prediction)

})
bentrueman/bgamcar1 documentation built on July 6, 2024, 11:16 p.m.