title: Apply Function Using Multiple Changing Arguments in R
body: <p>I want to apply a function over all rows referencing multiple columns in a data frame in R. So, for example, if I have a data frame called "data" with three variables "var1", "var2", and "var3" and I want to apply a function to each row:</p>
  
  <pre><code>myfunc &lt;- function(var1, var2, var3)){
  result &lt;- var1*var2*var3
  return(result)
  }
  </code></pre>
  
  <p>Then the pseudocode would be:</p>
  
  <pre><code>apply(data, myfunc(data$var1, data$var2, data$var3))
  </code></pre>
  
  <p>This code does not work, however, because data is a data frame, not a vector, and lapply does not seem able to take more than one vector. How do I make this work? I am open to any type of solution, but I have to be able to reference multiple changing arguments and call a predefined function.</p>