tests/testthat/test-collapse_na.R

example_na_expanded <- expand_na(data = example_na)

example_na_collapsed <- collapse_na(data = example_na_expanded)

test_that("Collapsed example_na returns the correct variable names", {

  expect_equal(
    names(example_na_collapsed),
    c("age", "sex", "labor_force", "health", "hours", "wages")
  )

})

test_that("collapse_na() is the inverse of expand_na()", {
  
  expect_equal(
    example_na,
    collapse_na(expand_na(example_na))
  )
  
})

Try the tidysynthesis package in your browser

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

tidysynthesis documentation built on March 17, 2026, 1:06 a.m.