tests/testthat/test_describe.R

library(testthat)
library(questionr)
context("describe() method")

test_that("describe() works with a labelled vector of NAs", {
  skip_if_not_installed("labelled")
  x <- rep(NA_real_, 10)
  labelled::val_labels(x) <- c(no = 0, yes = 1)
  expect_error(questionr::describe(x), NA) # no error
})

Try the questionr package in your browser

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

questionr documentation built on Feb. 16, 2023, 10:14 p.m.