fct_relabel <- function(.f, .fun, ...) {
f <- check_factor(.f)
.fun <- as_function(.fun)
old_levels <- levels(f)
new_levels <- .fun(old_levels, ...)
lvls_revalue(f, new_levels)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.