# Animated Data Visualizations Using R

## Animation Library

We will be using the animation library for the sake of completion of this project. In the words of the official documentation of the library, Animation Library provides functions for animations in statistics, covering topics in probability theory, mathematical statistics, multivariate statistics, non-parametric statistics, sampling survey, linear models, time series, computational statistics, data mining and machine learning. These functions may be helpful in teaching statistics and data analysis. Also provided in this

package are a series of functions to save animations to various formats, e.g. Flash, ‘GIF’, HTML pages, ‘PDF’ and videos. ‘PDF’ animations can be inserted into ‘Sweave’ / ‘knitr’ easily

In this tutorial, we will be creating an animated visualization portraying Brownian motion and display it in a HTML file.

The Code

```
library(animate)
desc = c("This is a super cool visualization of Brownian Motion")
saveHTML({
ani.options(interval = 0.1, nmax = 100) #ani.options() returns a list containing the options,nmax puts an upper bound on the number of levels)
par(mar = rep(0.5, 4))#The par() function is the main function for setting graphical parameters in base R and the mar = argument sets the size of the margins that surround the plot.
BM.circle(cex = 2, pch = 19)
},title = "Demo of Brownian Motion", description = desc, verbose = FALSE)
```

Write the code for your animation in saveHTML({}) to render it a new html page. You can find out the meanings of all the parameters that we used here by referring to the official documentation of Animations. Referring to the official documentation of a programming language is the second coolest way to learn about a new programming language/package after learning it from Codevita Live.