title: Using gganimate to export gif
body: <p>The package <code>gganimate</code> creates gifs (MWE code from <a href="https://stackoverflow.com/q/35399182/4798582">here</a>): </p>
  
  <pre><code>    library(ggplot2)
      #devtools::install_github('thomasp85/gganimate')
      library(gganimate)
  
      p &lt;- ggplot(mtcars, aes(factor(cyl), mpg)) + 
              geom_boxplot() + 
              # Here comes the gganimate code
              transition_states(
                      gear,
                      transition_length = 2,
                      state_length = 1
              ) +
              enter_fade() + 
              exit_shrink() +
              ease_aes('sine-in-out')
  </code></pre>
  
  <p>How can export this gif now? In the previous (now archived) version of <code>gganimate</code> this was simple:  </p>
  
  <pre><code>    gganimate(p, "output.gif")
  </code></pre>
  
  <p>However, I could not find an equivalent function in the current <code>gganimate</code> package. </p>
  
  <hr>
  
  <p><em>Note</em>: This question seems like an exact duplicated of the question from which I took the code for the MWE. However, <code>gganimate</code> has been updated and in the new version, displaying an animation in the viewer pane vs. exporting it seem to be different issues. </p>