repeated mutate in tidyverse
问题 consider the following tibble and the follwing vector: library(tidyverse) a <- tibble(val1 = 10:15, val2 = 20:25) params <- 1:3 Also I have a function myfun which takes a vector of arbitrary length and an integer as input and returns an vector of the same length. For demonstration purposes you can think of myfun <- function(x, k) dplyr::lag(x, k) I want to create the follwing: for each column in a and for each element in params I want to create a new column given by myfun(col, params[i]) . In