Q:

How to use mutate function with loops in R?

I am new at R. 
I wand to mutate 20 or more variables like below.
raw.data <- raw.data %>% 
  mutate(c_time = (c_time_2_1*60 + c_time_2_2) - (c_time_1_1*60 + c_time_1_2),
         m1_time = (m1_time_2_1*60 + m1_time_2_2) - (m1_time_1_1*60 + m1_time_1_2),
         m2_time = (m2_time_2_1*60 + m2_time_2_2) - (m2_time_1_1*60 + m2_time_1_2), 
         q_time = (q_time_2_1*60 + q_time_2_2) - (q_time_1_1*60 + q_time_1_2), 
         ...
         )

How can I use loop (whatever it is for-loop or map or else) list below in mutate function.
keys = c('c', 'm1', 'm2', 'm3', ... , 'm20', 'q', 'qpi', 'qsp', 'qpss', ... )

A:

We can try some non-standard evaluation : 
library(dplyr)
library(rlang)

bind_cols(raw.data, purrr::map_dfc(keys, ~transmute(raw.data, 
!!.x := !!sym(paste0(.x, '_time_2_1')) *60 + !!sym(paste0(.x, '_time_2_2')) - 
        !!sym(paste0(.x, '_time_1_1'))*60 + !!sym(paste0(.x, "_time_1_2")))))

