I'm attempting to reproduce the following code across 36 seperate columns in a df. So instead of having to retype this code 36 times, how can I apply a function to apply this for all columns at once? The columns in the df I need to apply them to are 4:40.
df <- df %>%
mutate(percent_score_1 = (score_1 / 5) * 100,
percent_score_2 = (score_2 / 5) * 100)
The data looks like this:
score_1 score_2
2 3
3 4
5 1
In case it is not clear, I am creating a percent score variable based on questions out of 5 points.
Thanks!!