Is there a function within forcats or elsewhere that returns the levels of a factor, but as a factor itself with the same levels? I find myself creating this function a fair bit - it's useful in combination with crossing(). Before adding it to my local package I was wondering if its equivalent exists already somewhere in the tidyverse or other common packages.
levels_w_levels <- function(x){
factor(levels(x),levels = levels(x))
}