tests/testthat/test-expandrows.R

test_that("expandrows repeats rows by count", {
  data <- data.frame(id = c(1, 2), value = c("a", "b"))

  out <- expandrows(data, times = c(2, 1))

  expect_s3_class(out, "basetable")
  expect_equal(out$id, c(1, 1, 2))
  expect_equal(out$value, c("a", "a", "b"))
})

Try the basetable package in your browser

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

basetable documentation built on Sept. 18, 2026, 9:13 a.m.