title: dplyr mutate multiple columns based on names in vectors
body: <p>I want to multiply two columns with each other by using <code>dplyr's mutate</code> function.  </p>
  
  <p>But instead of writing a new line for each mutate conditions I would like to use the names of the columns stored in the vectors <code>var1</code> and <code>var2</code>. For example in the end I want to have a additional column in my existing <code>bankdata</code> with the name <code>result1</code> which contains the result by multiplying the columns cash and loans with each other. This shall be continued until 3 new columns have been created.</p>
  
  <p>Reproducible code:</p>
  
  <pre><code>bankname &lt;- c("Bank A", "Bank B", "Bank C", "Bank D", "Bank E")
  bankid &lt;- c(1, 2, 3, 4, 5)
  year &lt;- c(1881, 1881, 1881, 1881, 1881)
  totass &lt;- c(244789, 195755, 107736, 170600, 32000000)
  cash &lt;- c(7250, 10243, 13357, 35000, 351266)
  bond &lt;- c(20218, 185151, 177612, 20000, 314012)
  loans &lt;- c(29513, 2800, NA, 5000, NA)
  bankdata &lt;- data.frame(bankname, bankid, year, totass, cash, bond, loans)
  </code></pre>
  
  <p>Vectors <strong>var1</strong> and <strong>var2</strong> contain the column names I want to multiply (<code>cash*loans, bond*cash, loans*bankid</code>) and <strong>output</strong> is the name of the new column:</p>
  
  <pre><code>var1 &lt;- c("cash", "bond", "loans")
  var2 &lt;- c("loans","cash", "bankid")
  output &lt;- c("result1", "result2", "result3")
  </code></pre>
  
  <p>I would like to do something similar like this:</p>
  
  <pre><code>bankdata %&gt;%
    mutate_at(.funs = funs(output = var1*var2), vars(var1, var2))
  
  bankdata %&gt;%
    mutate_at(.funs = funs(result1 = cash*., result2 = bond*., result3 = loans*.), vars(var2))
  </code></pre>