How do you relevel a factor with dplyr and mixedsort in the same pipe?
df %>%
relevel(.$var, mixedsort(levels(.$var)))
Results in error message "'relevel' only for (unordered) factors" even though var is a factor. I have also tried using the magrittr pipe and the relevel(var, mixedsort(levels(var))) but to no avail.
I guess this could all be done by saving mixedsort(levels(var)) and then calling it from within the relevel function but I would like to do it all in one relevel call if possible.
{}around it - akrun