tests/testthat/test-keep_na.R

df <- data.frame(x = c(1, 2, NA, NA), y = c("a", NA, "b", NA))

test_that("keep_na returns the correct result", {
  out <- keep_na(df, x)
  expect_true(all(is.na(out$x)))
})

test_that("keep_na selects all columns", {
  expect_equal(nrow(keep_na(df)), 1)
})

Try the hacksaw package in your browser

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

hacksaw documentation built on Jan. 13, 2021, 7:57 a.m.