tests/testthat/test-body-idx.R

# body <- x[-idx]
# out <- fill_(body, idx, fill)

# body <- body_(x, idx)
# out <- fill_(body, idx, fill)


test_that("body_ and fill_", {
  vec <- c(1,3,5,6,2)
  idx <- 4
  body <- body_(vec, idx)
  expect_equal(fill_(body, idx, NA), c(1,3,5,NA,2))
})

Try the transx package in your browser

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

transx documentation built on Nov. 27, 2020, 5:08 p.m.