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"))
})
tidyverse/forcats documentation built on Oct. 31, 2023, 7:32 p.m.