tests/testthat/test-shadow-shift-inf.R

df_inf <-  data.frame(x = c(-Inf,rnorm(2), NA, Inf))

test_that("missing values are replaced in shadow shift",{
  expect_false(anyNA(shadow_shift(df_inf$x)))
})

test_that("infinite values are maintained in shadow shift",{
  expect_equal(sum(is.infinite(shadow_shift(df_inf$x))), 2)
})

Try the naniar package in your browser

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

naniar documentation built on Feb. 16, 2023, 5:11 p.m.