I am trying to run a function of the following structure:
my_fun <- function(new_var_names, input_var_names, df){
df %>%
mutate(...)
}
Where an indefinite number of new variables are generated. Their names use each element of a character vector new_var_names
which has variable length. They are generated using as inputs the variables named in the character vector input_var_names
using some functions f1
and f2
.
Also ideally this should be done within mutate and without using mapping or looping procedures.
Is it possible to adapt mutate to do this ?
Thanks in advance.