title: Applying a matrix to a function
body: <p>Trying to apply a matrix to a function, using mapply without success</p>
  
  <p>I'm trying to solve a set of equations for different parameters. In a more simplistic form of the set of functions, I'm trying to pass a function to a matrix - constants -  </p>
  
  <pre><code>     a b c
  [1,] 1 4 7
  [2,] 2 5 8
  [3,] 3 6 9
  </code></pre>
  
  <p>and trying to solve the the equation <code>3*a + 2*b + 3*c</code> and return the answer for each row in the matrix. I have changed the original function to a linear and more simple one - that is why I prefer using #mapply and that former explanations have not assisted me. </p>
  
  <blockquote>
    <p>building the matrix </p>
  </blockquote>
  
  <pre><code>my_vector &lt;- 1:9
  constants &lt;- matrix(my_vector, 3, 3)
  colnames(constants) &lt;- c("a", "b", "c")
  constants
  </code></pre>
  
  <blockquote>
    <p>the target function</p>
  </blockquote>
  
  <pre><code>fun_abc &lt;- function(a, b, c){
    return(3 * a + 2 * b + 3 * c)
  }
  </code></pre>
  
  <blockquote>
    <p>applying constants to the function</p>
  </blockquote>
  
  <pre><code>mapply(fun_abc, 2, constants)
  </code></pre>
  
  <p>I keep getting Error in (function (a, b, c)  : argument "c" is missing, with no default
  Can anyone spot the problems?</p>