Have you ever heard about the ‘animation package’?
[This article was first published on The power of R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Well, I had never heard about it, but this morning I was looking for some information about another package and I found and article about this interesting package at ‘The R-Journal’ (http://journal.r-project.org/), it was on the Vol. 8/2, October 2008, by Yihui Xie and Xiaoyue Cheng, and it says something like...Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
“The animation package (Xie, 2008) uses graphical and
other animations to communicate the results of statistical
simulations, giving meaning to abstract statistical theory.”
Awesome!, isn’t it?. The basic idea of an animation, consists of multiple image frames, which can be designed to correspond to the successive steps of an algorithm or of a data analysis.
The basic schema for all animation functions in the package is:
ani.fun <- function(args.for.stat.method,args.for.graphics, ...) {
{stat.calculation.for.preparation.here}
i = 1
while (i <= ani.options("nmax") &other.conditions.for.stat.method) {
{stat.calculation.for.animation}
{plot.results.in.ith.step}
# pause for a while in this step
Sys.sleep(ani.options(“interval”))
i = i + 1
}
# (i – 1) frames produced in the loop
ani.options(“nmax”) = i – 1
{return.something}
}
I will leave this post here while I find the way to upload the animations in here, hope not to delay too much in that.
Have a nice day 😉
To leave a comment for the author, please follow the link and comment on their blog: The power of R.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.