title: Apply a list of n functions to each row of a dataframe?
body: <p>I have a list of functions</p>
  
  <pre><code>funs &lt;- list(fn1 = function(x) x^2,
               fn2 = function(x) x^3,               
               fn3 = function(x) sin(x),
               fn4 = function(x) x+1)
  #in reality these are all f = splinefun()
  </code></pre>
  
  <p>And I have a dataframe:</p>
  
  <pre><code>mydata &lt;- data.frame(x1 = c(1, 2, 3, 2),
                       x2 = c(3, 2, 1, 0),
                       x3 = c(1, 2, 2, 3),
                       x4 = c(1, 2, 1, 2))
  #actually a 500x15 dataframe of 500 samples from 15 parameters
  </code></pre>
  
  <p>For each of <em>i</em> rows, I would like to evaluate function <em>j</em> on each of the <em>j</em> columns and sum the results:</p>
  
  <pre><code>unlist(funs)
  attach(mydata)
  a &lt;- rep(NA,4)
  for (i in 1:4) {
       a[i] &lt;- sum(fn1(x1[i]), fn2(x2[i]), fn3(x3[i]), fn4(x4[i]))
  }
  </code></pre>
  
  <p>How can I do this efficiently? Is this an appropriate occasion to implement <code>plyr</code> functions? If so, how?</p>
  
  <p>bonus question: why is <code>a[4]</code> <code>NA</code>?</p>
  
  <p>Is this an appropriate time to use functions from <code>plyr</code>, if so, how can I do so?</p>