I have a data in wide format.e.g.
dt <- (age, gender, income, EDU1990, EDU1991, EDU1992, EDU1993, EDU1994, EDU1995 ..... EDU2021)
I am trying to select all the column with EDU and recode the variables in all of them at once. I tried to use the grep function but it is not working. Example :
grep(^EDU, dt) %>%
mutate(EDU = recode(^EDU, "highschool"=1, "college"=2)
Is there an easier/better way to select these multiple columns and pipe a function at once?