for (i in 1:360) { plot(1, ann = F, type = "n", axes = F) text(1, 1, "Animation", srt = i, col = rainbow(360)[i], cex = 7 * i/360) Sys.sleep(0.01)}
I have been studying in the major of statistics for more than 5 years (and there are still at least 3 years left), and I find one significant difference between the disciplines of pure mathematics and statistics: usually statistics can be imagined in a very practical way, while it is not true for mathematics. For example, I believe everyone can imagine why k-Nearest Neighbor technique works, but not everyone can imagine why Taylor expansion technique works although we can prove it!
Thus I wrote such a package: just for better understanding of statistical techniques and data analysis.
This package "animation" is available in CRAN now; the source code as well as Windows binary can be downloaded at:
http://cran.r-project.org/web/packages/animation/l
You may install by R CMD INSTALL after downloading the source or simply use install.packages() in R:
install.packages("animation")
I have written a vignette for this package explaining some details for animations in statistics, and this vignette is also an animation gallery (see Chapter 5).
Running animations either inside R (in graphical devices) or outside R (in HTML pages) are OK, as I provided an argument saveANI (actually in the argument control using the function ani.control()) to decide whether to save PNG files.
By ani.start(), specifying saveANI = TRUE, and ani.stop(), you can generate an HTML page containing the animation; or if saveANI = FALSE, the animations will be shown inside R graphical devices.
For further information, please check the help pages or the vignette.
For example, to create HTML animation pages, just use ani.start() and ani.stop(), otherwise if you just want to watch animations inside R, please check those animation functions such as brownian.motion(), cv.ani(), kmeans.ani(), knn.ani(), etc.
Please make sure R has write permission to your disk when saving animations (saveANI = TRUE).
I'll explain every animation function in the vignette (Chapter 5) as well as in this site.