title: dplyr::group_modify to apply function
body: <p>I would like to apply a function (calculate the binomial confidence interval) on each group in a dataframe. Assume that I have a dataframe containing the following:</p>
  
  <pre><code> df &lt;- data.frame(group_name = sample(letters[1:5], 20, replace = T), numbers = 1:20, other_numbers = 51:70)
  </code></pre>
  
  <p>I group by the group_name and create a vector to feed into the exactci function:</p>
  
  <pre><code>install.packages('PropCIs');library('PropCIs') 
  
  df2 &lt;- df %&gt;% 
     group_by(group_name) %&gt;% 
     vector = c(numbers, other_numbers) %&gt;%
     mutate(CI = exactci(vector, conf.level = 0.95))
  </code></pre>
  
  <p>But the levels of my binomial variable are unavailable. </p>
  
  <p>Ideally, I would also like to apply dplyr::group_modify to create a table that contains the confidence intervals for the binomial variable for each group, in addition to the new variable in the dataframe that contains the CIs. </p>