Learn R Programming

animation (version 2.0-0)

g.brownian.motion: Brownian Motion using Google Visualization API.

Description

Brownian Motion using Google Visualization API.

Usage

g.brownian.motion(p = 20, start = 1900, digits = 14, 
    file = file.path(ani.options("outdir"), ani.options("htmlfile")), 
    width = 800, height = 600)

Arguments

p
number of points
start
start ``year''; it has no practical meaning in this animation but it's the required by the Google gadget
digits
the precision to round the numbers
file
the file name
width,height
width and height of the animation

Value

  • NULL. An HTML page will be opened as the side effect.

Details

We can use R to generate random numbers from the Normal distribution and write them into an HTML document, then the Google Visualization gadget ``motionchart'' will prepare the animation for us (a Flash animation with several buttons).

References

http://code.google.com/apis/visualization/ http://yihui.name/en/2008/11/brownian-motion-using-google-visualization-api-and-r/

See Also

brownian.motion, BM.circle, rnorm

Examples

Run this code
oopt = ani.options(htmlfile = "BM-motion-chart.html")

g.brownian.motion(15, digits = 2, width = 600, height = 500)

unlink(file.path(ani.options("outdir"), ani.options("htmlfile")))

ani.options(oopt)

Run the code above in your browser using DataLab