R function for making .gif animations with spplot