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 fritools2 package in your browser

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

fritools2 documentation built on July 9, 2023, 7:07 p.m.