I like the default behavior of gganimate that makes a looping gif of my output, and would like to get that looping input to show up in the .Rmd file of an RStudio Notebook.
The following code, found here, comes close to what I want. However, unlike the gif, it only plays once and doesn't loop.
```{r, warning=FALSE, message=FALSE, results = FALSE}
library(ggplot2)
library(gganimate)
p <- ggplot(iris) +
aes(Petal.Width, Petal.Length) +
geom_point() +
transition_states(Species,
transition_length = 2,
state_length = 1)
animate(p, renderer = ffmpeg_renderer(format = "webm"))
```
Furthermore, as per OP's unanswered comment on that site, I also get the same unwanted output to the console
Input #0, image2, from '/tmp/RtmpnXCx5F/df873f8219e/gganim_plot%4d.png':
Duration: 00:00:04.00, start: 0.000000, bitrate: N/A
Stream #0:0: Video: png, pal8(pc), 480x480, 25 fps, 25 tbr, 25 tbn, 25 tbc
and so on, even with the warnings, message and results set to false.
Any suggestions for how I can get this ffmpeg to loop, at least a few times, or better yet loop indefinately while keeping it inline in the .Rmd file? Suggestions for banishing the information about the rendering would be appreciated as well. Thanks.