use ggplot() every group applyed group_by()
<p>I use <code>facet_wrap</code> to every group plot, 
but I need to save every plot individual and find the under link.</p>

<p>I tried program  the answer in the URL link and can save PDFfile, 
but present the ERROR MASSAGE.</p>

<p>CODE:</p>

<pre><code>iris %&gt;% group_by(Species) %&gt;% 
  do({
    p &lt;- ggplot(., aes(x =Sepal.Length, y = Petal.Length)) + geom_point()
    ggsave(p, filename = paste0("fig/", unique(.$Species), ".pdf"))
  })
</code></pre>

<p>ERROR MESSAGE:</p>

<p><code>Results are not data frames at positions: 1, 2, 3</code></p>

<p>URL:
<a href="https://stackoverflow.com/questions/27556707/applying-a-function-to-the-output-of-dplyrs-group-by">applying a function to the output of dplyr's group_by</a></p>