Blog Archives

Looking for Software Paths in Windows Registry

March 28, 2010
By
Looking for Software Paths in Windows Registry

hen we want to call external programs in R under Windows, we often need to know the paths of these programs. For instance, we may want to know where ImageMagick is installed, as we need the convert (convert.exe) utility to convert images to other formats, or where OpenBUGS is installed because we need this path

Read more »

A Demo for the Ratio Estimation in Sampling Survey (Animation)

March 24, 2010
By
A Demo for the Ratio Estimation in Sampling Survey (Animation)

mber Watkins gave me a suggestion on the animation for the ratio estimation, and I think this is a good topic for my animation package. I’ve finished writing the initial version of the function sample.ratio() for this package, which will appear in the version 1.1-2 a couple of days later. As we know, the benefit

Read more »

Font Families for the R PDF Device

March 24, 2010
By

otivated by the excellent R package pgfSweave, I begin to notice the font families in my graphs when writing Sweave documents. The default font family for PDF graphs is Helvetica, which is, in most cases (I think), inconsistent with the LaTeX font styles. Some common font families are listed in ?postscript, and we can take

Read more »

R Tips in Stat 511

March 22, 2010
By
R Tips in Stat 511

Here are some (trivial) R tips in the course Stat 511. I’ll update this post till the semester is over. Formatting R Code Reading code is pain, but the well-formatted code might alleviate the pain a little bit. The function tidy.source() in the animation package can help us format our R code automatically. By default

Read more »

Guess the Random Seed

March 12, 2010
By

tephanie asked in 511 today if we were able to get the random seed which was set by set.seed() but we were only given the random numbers (without knowing the seed). This kind of “hacker” questions sound interesting. One dirty solution should be the brute-force method, e.g: # x: the random vector; # FUN: the

Read more »

Press Enter in LyX Sweave as You Wish

February 18, 2010
By
Press Enter in LyX Sweave as You Wish

or a long time I’ve been wondering why we are not able to use Enter in the LyX Scrap environment which was set up by Gregor Gorjanc for Sweave. Two weeks ago, I (finally!) could not help asking Gregor about this issue, as I’m using “LyX + Sweave” more and more in my daily work.

Read more »

Happy New Year with R

December 31, 2009
By

I have to admit that the previous post on Christmas is actually not much fun. Today I received another pResent from Yixuan which is more interesting:Basically the code deals with letter polygons (i.e. glyphs) and plot them with proper projections from 3D to 2D space: ## original code by Yixuan <[email protected]>, with my slight modification h.x =

Read more »

Merry Christmas Using R

December 24, 2009
By

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 <- runif(angle <- runif(x

Read more »

Create Animations in PDF Documents Using R

November 11, 2009
By

ince animation 1.0-9, we will be able to create a PDF document with an animation embedded in it; the function is saveLatex(), and its usage is similar to saveMovie() and saveSWF(): you pass an R expression for creating animations to this function, and this expression will be evaluated in the function; the image frames get

Read more »

Some Interesting Packages in R: swfDevice, RGoogleTrends, FlashMXML, SVGAnnotation

October 19, 2009
By

I love R because there are always exciting new packages which can be far beyond your imagination. Here I’d like to introduce a couple of packages that look really awesome: 1. swfDevice: R graphics device for SWF output (by Cameron Bracken) This package is still at a pre-alpha stage but you can see a sketch now in

Read more »