I asked about method to rename factors and the selected answer uses fct_relabel
on the factor vector only.
df$grp = df$grp %>% fct_relabel(str_replace, "_something", "")
But df
in my usage is often the result from tidyr::gather
and I don't feel like breaking the %>%
pipe to name it just to do fct_relabel
, and then resume the pipe. Any suggestions? Thanks!