tests/testthat/test-rev.R

test_that("reverses levels", {
  f1 <- factor(c("a", "b", "a"))
  f2 <- fct_rev(f1)

  expect_equal(levels(f2), c("b", "a"))
})
hadley/forcats documentation built on Nov. 4, 2023, 2:24 a.m.