<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Statistics, R, Graphics and Fun &#187; ani.start()</title>
	<atom:link href="http://yihui.name/en/tag/ani-start/feed/" rel="self" type="application/rss+xml" />
	<link>http://yihui.name/en</link>
	<description>Yihui XIE</description>
	<lastBuildDate>Fri, 23 Jul 2010 16:33:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Merry Christmas Using R</title>
		<link>http://yihui.name/en/2009/12/merry-christmas-using-r/</link>
		<comments>http://yihui.name/en/2009/12/merry-christmas-using-r/#comments</comments>
		<pubDate>Thu, 24 Dec 2009 22:50:33 +0000</pubDate>
		<dc:creator>Yihui Xie</dc:creator>
				<category><![CDATA[R Graphics]]></category>
		<category><![CDATA[ani.start()]]></category>
		<category><![CDATA[ani.stop()]]></category>
		<category><![CDATA[Animation]]></category>
		<category><![CDATA[Christmas]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[R Language]]></category>
		<category><![CDATA[saveLatex()]]></category>
		<category><![CDATA[saveSWF()]]></category>

		<guid isPermaLink="false">http://yihui.name/en/?p=415</guid>
		<description><![CDATA[Life should be fun. I saw a post in R-help list saying Merry Christmas to other useRs, and I followed up by some R code which can produce a naive animation like this: Here is the code to generate the above Flash animation with shining Christmas: library(animation) saveSWF({ n = length(speed &#60;- runif(angle &#60;- runif(x [...]]]></description>
			<content:encoded><![CDATA[<p>Life should be fun. I saw a post in R-help list saying Merry Christmas to other useRs, and I followed up by some R code which can produce a naive animation like this:</p>
<div style="text-align: center;"><object style="width: 600px; height: 75px;" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="600" height="75" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://yihui.name/en/wp-content/uploads/2009/12/xmas-2009-animation.swf" /><embed style="width: 600px; height: 75px;" type="application/x-shockwave-flash" width="600" height="75" src="http://yihui.name/en/wp-content/uploads/2009/12/xmas-2009-animation.swf"></embed></object></div>
<p>Here is the code to generate the above Flash animation with shining Christmas:</p>
<pre>library(animation)
saveSWF({
    n = length(speed &lt;- runif(angle &lt;- runif(x &lt;- strsplit("MERRY CHRISTMAS",
        "")[[1]], 0, 360), 0, 15))
    for (j in 1:300) {
        angle = angle + speed
        plot.new()
        plot.window(c(1, n), c(0, 1))
        for (i in 1:n) text(i, 0.5, x[i], srt = angle[i], cex = runif(1,
            1, 4), col = sample(colors(), 1))
        text(n, 0, "Yihui @ 2009-12-24 (http://yihui.name)",
            adj = c(1, 0), col = "white", cex = 0.8)
    }
}, interval = 0.04, dev = "pdf", outdir = getwd(), para = list(mar = rep(0,
    4), bg = "black"), width = 8, height = 1)
## in animation package (&gt;=1.1-0), see demo('Xmas')</pre>
<p>There are other animation formats in the R package <code>animation</code>:</p>
<ol>
<li>use <code>saveMovie()</code> to get a GIF animation (need ImageMagick)</li>
<li><code>ani.start()</code> and <code>ani.stop()</code> can produce an HTML page with the animation in it</li>
<li><code>saveLatex()</code> can embed an animation into a PDF document</li>
</ol>
<h2  class="related_post_title">Related Posts</h2><ul class="related_post"><li><a href="http://yihui.name/en/2009/12/happy-new-year-with-r/" title="Happy New Year with R">Happy New Year with R</a></li><li><a href="http://yihui.name/en/2009/06/simulation-of-burning-fire-in-r/" title="Simulation of Burning Fire in R">Simulation of Burning Fire in R</a></li><li><a href="http://yihui.name/en/2010/03/a-demo-for-the-ratio-estimation/" title="A Demo for the Ratio Estimation in Sampling Survey (Animation)">A Demo for the Ratio Estimation in Sampling Survey (Animation)</a></li><li><a href="http://yihui.name/en/2009/11/create-animations-in-pdf-documents-using-r/" title="Create Animations in PDF Documents Using R">Create Animations in PDF Documents Using R</a></li><li><a href="http://yihui.name/en/2009/10/50000-revisions-committed-to-r/" title="50000 Revisions Committed to R">50000 Revisions Committed to R</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://yihui.name/en/2009/12/merry-christmas-using-r/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
