title: Write list of data frames to Excel in multiple sheets
body: <p>I have a data frame that I run a few analyses on and I want to export the results to Excel files. One workbook per group and each analysis results on a separate tab. I would prefer to use <code>openxlsx</code> for the exporting to take java out of the equation.</p>
  
  <pre><code>library(plyr)
  library(dplyr)
  library(openxlsx)
  
  df &lt;- iris
  
  # Analysis 1
  results1 &lt;- df %&gt;%
    group_by(Species) %&gt;%
    summarise(count = n())
  
  # Analysis 2
  results2 &lt;- df %&gt;%
    group_by(Species) %&gt;%
    summarise(mean.sl = mean(Sepal.Length),
              mean.sw = mean(Sepal.Width))
  </code></pre>
  
  <p>My desired export output would be three Excel workbooks, <code>setosa.xlsx</code>, <code>versicolor.xlsx</code>, and <code>virginica.xlsx</code>; each with two sheets "results1" and "results2" containing only their within-group results. Meaning no setosa rows in the versicolor Excel file.</p>
  
  <p>I tried to split <code>results1</code> and <code>results2</code> into lists of data frames in order to use <code>lappy</code> with <code>write.xlsx</code> but I'm not able to make it work.</p>
  
  <pre><code>r1_list &lt;- dlply(results1, .(Species))
  r2_list &lt;- dlply(results2, .(Species))
  </code></pre>
  
  <p>Other suggestions?</p>