tests/testthat/test-md.pattern.R

context("md.pattern")

test_that("patterns run as expected", {
  # boys
  expect_silent(md.pattern(boys, plot = FALSE))
  # nhanes
  expect_silent(md.pattern(nhanes, plot = FALSE))
  # one whole column missing (single pattern) - should not produce output
  expect_silent(md.pattern(cbind(na.omit(nhanes), NA), plot = FALSE))
  # no missings (no pattern) - should produce output
  expect_output(md.pattern(na.omit(nhanes), plot = FALSE))
  # feed single column - expect error
  expect_error(md.pattern(nhanes$bmi))
  # feed other than dataframe/matrix - expect error
  expect_error(md.pattern(as.list(nhanes)))
  #
})

Try the mice package in your browser

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

mice documentation built on June 7, 2023, 5:38 p.m.