title: How can I write dplyr groups to separate files?
body: <p>I'm trying to create separate .csv files for each group in a data frame grouped with dplyr's group_by function.  So far I have something like</p>
  
  <pre><code>by_cyl &lt;- group_by(mtcars, cyl)
  do(by_cyl, write_csv(., "test.csv"))
  </code></pre>
  
  <p>As expected, this writes a single .csv file with only the data from the last group.  How can I modify this to write multiple .csv files, each with filenames that include cyl?</p>