tests/testthat/test-uncount_dt.R

test_that("uncount", {
  df <- data.table(x = c("a", "b"), n = c(1, 2))

  expect_equal(
    uncount_dt(df, n),
    data.table(x = c("a","b","b"))
  )

  expect_equal(
    uncount_dt(df,n,FALSE),
    data.table(x = c("a","b","b"),n = c(1,2,2))
  )

})

Try the tidyfst package in your browser

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

tidyfst documentation built on Sept. 16, 2024, 9:06 a.m.