I need some help tidying my data. I\'m trying to convert some integers to factors (but not all integers to factors). I think I can do with selecting the variables in question
As of dplyr 1.0.0 released on CRAN 2020-06-01, the scoped functions mutate_at(), mutate_if() and mutate_all() have been superseded thanks to the more generalizable across(). This means you can stay with just mutate(). The introductory blog post from April explains why it took so long to discover.
Toy example:
library(dplyr)
iris %>%
mutate(across(c(Sepal.Width,
Sepal.Length),
factor))
In your case, you'd do this:
library(dplyr)
raw_data_tbl %>%
mutate(across(c(is.numeric,
-contains("units"),
-c(PRO_ALLOW, RTL_ACTUAL, REAL_PRICE, REAL_PRICE_HHU,
REBATE, RETURN_UNITS, UNITS_PER_CASE, Profit,
STR_COST, DCC, CREDIT_AMT)),
factor))