tests/testthat/test_classify_intervals.R

testthat::test_that('classify_intervals works as expected', {

  data <- data.frame(value = c(1, 2, 3))
  breaks <- c(1, 2, 3)

  res <- classify_intervals(data, "value", breaks)

  testthat::expect_identical(levels(res$value),
                             c("(1.0 to 2.0]", "(2.0 to 3.0]"))

})
hamishgibbs/ggutils documentation built on Feb. 24, 2023, 1:22 a.m.