Description Usage Arguments Value Note Author(s) References See Also Examples
View source: R/g.brownian.motion.R
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).
1 2 3 4 5 6 7 8 | g.brownian.motion(
p = 20,
start = 1900,
digits = 14,
file = "index.html",
width = 800,
height = 600
)
|
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 HTML filename |
width, height |
width and height of the animation |
NULL
. An HTML page will be opened as the side effect.
The number of frames is controlled by ani.options('nmax')
as
usual.
Due to the “security settings” of Adobe Flash player, you might not be able to view the generated Flash animation locally, i.e. using an address like file:///C:/Temp/index.html. In this case, you can upload the HTML file to a web server and use the http address to view the Flash file.
Yihui Xie
https://developers.google.com/chart/?csw=1 and https://yihui.org/en/2008/11/brownian-motion-using-google-visualization-api-and-r/
brownian.motion
, BM.circle
,
rnorm
1 2 | if (interactive()) g.brownian.motion(15, digits = 2, width = 600, height = 500,
file = "BM-motion-chart.html")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.