'R raster: saving a movie created with animate to a file?

Is there a way to save (to a file) a movie created in the raster package? I can make an animation that I'm quite satisfied with (happens to be a raster time series), and it displays nicely in the RStudio plots window, but I can't figure out how to save it as a movie. For example:

library(raster)

b <- brick(system.file("external/rlogo.grd", package="raster"))
raster::animate(b, n=1)

Is there a way to save this animation to a file?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source