Monday, March 03, 2014

Fwd: [New post] I love the animation package in R!

Joel Schneider does it again...amazing Gv animated presenations


---------- Forwarded message ----------
From: Assessing Psyche, Engaging Gauss, Seeking Sophia <comment-reply@wordpress.com>
Date: March 3, 2014 at 6:33:04 PM CST
Subject: [New post] I love the animation package in R!
To: wj3chc@gmail.com

WordPress.com
W. Joel Schneider posted: "I am grateful that we live in an age in which individuals like Yihui Xie make things that help others make things. Aside from his extraordinary work with knitr, I am enjoying the ability to make any kind of animation I want with his animation package. My "
Respond to this post by replying above this line

New post on Assessing Psyche, Engaging Gauss, Seeking Sophia

I love the animation package in R!

by W. Joel Schneider

I am grateful that we live in an age in which individuals like Yihui Xie make things that help others make things. Aside from his extraordinary work with knitr, I am enjoying the ability to make any kind of animation I want with his animation package. My introductory stats lectures are less boring when I can make simple graphs move:

Correlations

Correlations

Code:
cnt<-1000
for (i in c(-0.9999,-0.999,seq(-0.995,0.995,0.005),0.999,0.9999,0.999,seq(0.995,-0.995,-.005),-0.999)){
Cairo(file=paste0("S",cnt,".png"),bg="white",width=700,height=700)
cnt<-cnt+1
rho<-i
plot(matrix(rep(1,2*n),nrow=n)%*%diag(m)+d%*%chol(matrix(c(1,rho,rho,1),nrow=2))%*%diag(s),pch=16,col=rgb(0,0.12,0.88,alpha=0.3),ylab="Y",xlab="X", xlim=c(40,160), ylim=c(40,160),axes=F,main=bquote(rho==.(format(round(rho,2),nsmall=2))))
lines(c(40,160),(c(40,160)-100)*rho+100,col="firebrick2")
axis(1)
axis(2)
dev.off()
}
ani.options(convert = shQuote('C:/Program Files/ImageMagick-6.8.8-Q16/convert.exe'),ani.width=700, ani.height=800,interval = 0.05,ani.dev="png",ani.type="png")
im.convert("S*.png",output="SEE1.gif",extra.opts="-dispose Background",clean=T)

W. Joel Schneider | March 4, 2014 at 12:32 am | Tags: animation, R, Yihui Xie | Categories: R, Statistics | URL: http://wp.me/p177GY-ln

Comment    See all comments

Unsubscribe to no longer receive posts from Assessing Psyche, Engaging Gauss, Seeking Sophia.
Change your email settings at Manage Subscriptions.

Trouble clicking? Copy and paste this URL into your browser:
http://assessingpsyche.wordpress.com/2014/03/04/i-love-the-animation-package-in-r/

Thanks for flying with WordPress.com

No comments: