tests/testthat/_snaps/relabel.md

gives useful errors

Code
  fct_relabel(f1, 1)
Condition
  Error in `fct_relabel()`:
  ! Can't convert `.fun`, a number, to a function.
Code
  fct_relabel(f1, function(x) 1)
Condition
  Error in `lvls_revalue()`:
  ! `new_levels` must be a character vector, not the number 1.
Code
  fct_relabel(f1, function(x) x[-1])
Condition
  Error in `lvls_revalue()`:
  ! `new_levels` must be the same length (0) as `levels(f)` (1).


Try the forcats package in your browser

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

forcats documentation built on Feb. 16, 2023, 8:57 p.m.