Great solution, @mara!
I was wrong on my previous answer. I guess it's a long day for me after all Sorry about that!
Just for reference, fct_collapse()
is expecting a series of named character vectors, as you can see by the ...
parameter of the function. So a named list is not appropriate and some manual conversion is needed, at least in the current version of forcats
.