inst/tinytest/test_count_groups.R

if (interactive()) {
  pkgload::load_all()
  library("tinytest")
}


result <- count_groups(mtcars, "am", "gear")
expectation <- structure(list(
  am = c(0, 0, 1, 1),
  gear = c(3, 4, 4, 5),
  count = c(15L, 4L, 8L, 5L)
),
row.names = c(NA, -4L), class = "data.frame"
)
expect_identical(result, expectation)

Try the fritools package in your browser

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

fritools documentation built on June 8, 2025, 11:59 a.m.