tests/testthat/test-checks.R

test_that("detects missing variables", {
	foo <- data.frame(a = 1, w = 1, m = 1, z = NA, y = 1)
	expect_error(
		crumble(foo, "a", "y", "m", "z", "w"),
		"Assertion on 'data' failed: Missing data found in treatment/covariate/mediator/observed nodes."
	)
})

Try the crumble package in your browser

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

crumble documentation built on April 13, 2025, 5:10 p.m.