Package Presentation

Your Name

Lead Author: Yihui Xie

Software engineer at Rstudio PhD Department of Statistics, Iowa State University Founded Chinese website Capital of Statistics & initiated 1st Chinese R conference

R packages: * animation * formatR * knitr

“I know I cannot eat code, so I cook almost every day to stay away from my computer for two hours.”

Animation package

Makes animations!

  • probability theory
  • mathematical statistics
  • multivariate statistics
  • nonparametric statistics
  • sampling survey
  • linear models
  • time series
  • computational statistics
  • data mining
  • machine learning

Save to Flash, GIF, HTML pages, PDF and videos

Basic steps…

  1. Uses a ’loop’ to make a series of plots
  2. Package ‘combines’ them into an animation

Example Code: Linear Regression

library(animation)
saveGIF({    
ani.options(interval = 0.3, nmax = 50)
  par(
    mar = c(4, 4, 0.5, 0.1),
    mgp = c(2, 0.5, 0),
    tcl = -0.3)
  least.squares()
  },
img.name = "least.squares",
htmlfile = "least.squares.gif",
ani.height = 600, 
ani.width = 1000,
title = "Demonstration of Least Squares")
## Executing: 
## convert -loop 0 -delay 30 least.squares1.png least.squares2.png
##     least.squares3.png least.squares4.png least.squares5.png
##     least.squares6.png least.squares7.png least.squares8.png
##     least.squares9.png least.squares10.png least.squares11.png
##     least.squares12.png least.squares13.png least.squares14.png
##     least.squares15.png least.squares16.png least.squares17.png
##     least.squares18.png least.squares19.png least.squares20.png
##     least.squares21.png least.squares22.png least.squares23.png
##     least.squares24.png least.squares25.png least.squares26.png
##     least.squares27.png least.squares28.png least.squares29.png
##     least.squares30.png least.squares31.png least.squares32.png
##     least.squares33.png least.squares34.png least.squares35.png
##     least.squares36.png least.squares37.png least.squares38.png
##     least.squares39.png least.squares40.png least.squares41.png
##     least.squares42.png least.squares43.png least.squares44.png
##     least.squares45.png least.squares46.png least.squares47.png
##     least.squares48.png least.squares49.png least.squares50.png
##     'animation.gif'
## Output at: animation.gif