tests/testthat/test_utilities.R

library(toxboot)
context("Utility functions are performing correctly")

test_that("NULLs are replaced by NAs", {
  x <- list(1,2,'a', NA, 6, NULL, '10')
  y <- nullToNA(x)
  expect_is(y, "list")
  expect_equal(length(x), length(y))
  expect_equal(sum(sapply(y, is.null)),0L)
  expect_true(is.na(y[6]))
})

Try the toxboot package in your browser

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

toxboot documentation built on Nov. 26, 2018, 1:04 a.m.