Open
Description
I often need to map a factor to another variable that either is already a factor or I need to make into a factor.
Would you consider including something like the following?
fct_mirror <- function(.f, .x) {
factor(.x, levels=levels(.f), ordered=is.ordered(.f))
}
(This would solve an issue similar to tidyverse/dplyr#3731 by allowing fct_mirror(my_factor, case_when(...))
.)