title: Is there an R function/approach that enables you to apply a custom function to each group of a grouped data frame?
body: <p>In R, I am attempting to apply a custom function to each individual group of a dataframe (that is grouped by a particular column)
  The function itself is designed to take in a subset (one group) of the whole data frame and return a modified data frame. Ideally, I would like the final output to be a single data frame with the same combined groups, but each group is modified by the function before being binded back into the whole data frame.</p>
  
  <p>For example:</p>
  
  <pre><code>employee &lt;- c('John Doe','Peter Gynn','Jolie Hope'...)
  month &lt;- c('Jan','Feb','Mar'...)
  monthlysalary &lt;- c(21000, 23400, 26800...)
  startdate &lt;- as.Date(c('2010-11-1','2008-3-25','2007-3-14')...)
   employ.data &lt;- data.frame(employee, month, salary, startdate, stringsAsFactors=FALSE)
  </code></pre>
  
  <p>I would like to apply some custom function:</p>
  
  <pre><code>func = function(df_subset) {
  ##functions mutates monthlysalary of dataframe  - cannot include exact code for privacy reasons##
  }
  </code></pre>
  
  <p>to the original data frame grouped by the column employee (<code>employ.data %&gt;% group_by(employee)</code>) So, the function only changes the column monthly salary of each employee in isolation. The function actually considers row indexes for each group and since the groups are of unequal length, I have to apply the function to each group in isolation.</p>
  
  <p>I have struggled to successfully use any of the dyplyr apply functions.</p>
  
  <p>Any help would be greatly appreciated.
  Thank you,</p>