title: Return result of function as dataframe row using Mapply
body: <p>I have a reasonably large R data frame. I wish to use mapply to take inputs from several of the columns, and pass them on a row by row basis to a function, the return from this will be a 5 digit numeric vector, which I wish to assign, again on a row by row basis, to ten columns in the original data frame.</p>
  
  <p>So far so good, and it is working fine.</p>
  
  <p>But additionally I want to be able to do this on a subset of rows.</p>
  
  <p>Thus to call the '<code>my.function</code>' function for all rows in <code>my.df</code>, using columns <code>my.df$a</code>, <code>my.df$b</code> and <code>my.df$c</code> as inputs, and output to for example <code>my.df</code> columns 11 to 15 , syntax would be;</p>
  
  <pre><code>my.df[,11:15]&lt;-mapply(my.function, my.df$a, my.df$b, my.df$c)
  </code></pre>
  
  <p>however if I want to run that over a large but not complete subset of the data frame, the syntax seems to be a bit messier.</p>
  
  <p>If I say that my.subset is the vector containing the rows to subset, syntax would look thus;</p>
  
  <pre><code>my.df[my.subset,11-15]&lt;-mapply(my.function, my.df$a[my.subset], my.df$b[my.subset], my.df$c[my.subset])
  </code></pre>
  
  <p>Seems a little long winded to keep referring to [<code>my.subset</code>]</p>
  
  <p>Is there a slightly more succinct yet readable way to do this?</p>
  
  <p>addendum: ideally the solution will not preclude me from making this call parallel in future as I have some pretty large data frames to process and want to start using the machine more efficiently.</p>