title: r map_df to invoke_map translation
body: <p>I would like to apply multiple functions over multiple columns in a data frame. I've worked out how to apply one function to all the columns in a data frame, but I'm stumped trying to use invoke_map to apply a list of functions. I've played around with quo and enquo, but I don't have the right combination (or grasp yet, I guess).</p>
  
  <p>Toy example set up:</p>
  
  <pre><code>library(tidyverse)
  library(RcppRoll)
  library(purrr)
  
  ID &lt;- letters[1:26]
  var1 &lt;- sample(1:100, 26, replace= T)
  var2 &lt;- sample(100:200, 26, replace= T)
  temp &lt;- cbind(ID, var1, var2) %&gt;% data.frame()
  </code></pre>
  
  <p>This works to apply one function: </p>
  
  <pre><code>roll.var &lt;- function(name) {
    label &lt;- enquo(name)
    map_df(temp[, 2:3], ~ name(.x, 5, fill= NA)) %&gt;%
    rename_all(funs(paste0(., '.', (!!label)))) %&gt;%
    cbind(temp, .)
  }
  
  test &lt;- roll.var(roll_sdr)
  </code></pre>
  
  <p>Here's my attempt to use invoke_map to apply a list of functions to the chosen columns:</p>
  
  <pre><code>roll.func &lt;- c("roll_sdr", "roll_varr")
  
  invoke_map(roll.var, .x= roll.func)
  </code></pre>
  
  <p>And it returns: Error in name(.x, 51, fill = NA) : could not find function "name"</p>
  
  <p>The second issue is that in the resulting 'test' data frame from the first example, the first variable is named incorrectly (var1.~) whereas the second one is named how I anticipated (var2.roll_sdr), can any one tell me why?</p>
  
  <p>Any solution and/or education would be much appreciated!</p>
  
  <p>EDIT:</p>
  
  <p>Incorporating Mike's explanation that invoke_map needs a list of lists the complete code to produce what I want is:</p>
  
  <pre><code>library(tidyverse)
  library(purrr)
  library(RcppRoll)
  library(plyr)
  
  options(stringsAsFactors= F)
  
  ID &lt;- letters[1:26] %&gt;% data.frame(ID= .)
  var1 &lt;- sample(1:100, 26, replace= T) %&gt;% data.frame(var1= .)
  var2 &lt;- sample(100:200, 26, replace= T) %&gt;% data.frame(var2= .)
  temp &lt;- bind_cols(ID, var1, var2)
  
  
  roll.func &lt;- list(list(roll_sdr, 'roll_sdr'),
                    list(roll_varr, 'roll_varr'))
  
  roll.var &lt;- function(name, vname) {
    map_df(temp[, 2:3], ~ name(.x, 5, fill= NA)) %&gt;%
      rename_all(funs(paste0(., '.', vname))) %&gt;%
      cbind(temp, .)
  }
  
  df &lt;- invoke_map(roll.var, roll.func)
  ## plyr statrment works much faster than purrr:reduce
  df2 &lt;- join_all(df, by= c('ID', 'var1', 'var2'))
  </code></pre>
  
  <p>Is it possible to add a statement in the roll.var function so that the vname doesn't have to be reiterated in roll.func? Somehow quote the name once inside the function? I've played around enquo and the rlang package and I'm not coming up with the right combination.</p>
  
  <pre><code>roll.func &lt;- list(list(roll_sdr),
                    list(roll_varr))
  </code></pre>
  
  <p>would work both as a function call, and in appending the label to the variable name.</p>