tests/testthat/test-allna.R

if (require("testthat") && require("sjmisc")) {
  x <- c(NA, NA, NA)
  y <- c(1, NA, NA)

  test_that("all_na", {
    expect_true(all_na(x))
  })

  test_that("all_na", {
    expect_false(all_na(y))
  })

  test_that("all_na, data.frame", {
    expect_is(all_na(data.frame(x, y)), "data.frame")
  })
}

Try the sjmisc package in your browser

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

sjmisc documentation built on Dec. 11, 2021, 9:34 a.m.