tests/testthat/test-filter_na.R

nice_data <-
  data.frame(
    c1 = c(NA, 4, NA),
    c2 = c(NA, 2, 5),
    c3 = c(NA, "b", NA)
  )

test_that("filter_na(type='any') works", {
  filtered_any <- filter_na(nice_data, "any")
  expect_equal(nrow(filtered_any), 2)
})

test_that("filter_na(type='all') works", {
  filtered_all <- filter_na(nice_data, "all")
  expect_equal(nrow(filtered_all), 1)
})

Try the misc package in your browser

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

misc documentation built on April 8, 2026, 9:10 a.m.