Monthly Archives: February 2016

R Animation – Can not get easier than this… Contributions from Gurus…


The above animations were courtesy of the works from the fifth link, below.

Animation is building a series of images and combining them as a movie.

There are three slightly different ways to do animation. 

(1) You may use package ‘animation’.  This has built it saving facility, to save Flash, GIF, HTML pages, PDF, and Videos, such as saveSWF(), saveGIF(), saveHTML(), saveLatex(), and saveVideo().  While HTMLpages are created using the R and javascript, we need PDF creator for embedding animated graphics with in PDF.

(2) Or you can use R, statistical calculations, and lapply and plot functions, to get codes to draw the sequence of gif files. Combine them using save.gif function available in R, which in turn needs a software in your system to be installed, called, imagemagik (Windows download) – available at the bottom of the site.  Here block updates as screen shots seems to work easily.  These you do them on your own. Going through these helps you understand the foundations of animations.

This approach uses ggplot to capture varying screen shots, with out using gganimate.

(3) Or you can use gganimate to do the animation.

All the methods fundamentally use the following pseudo code approach. (this snippet is from the first reference below) <- function(args.for.stat.method,, …)
i = 1
while (i <= ani.options(“nmax”) & other.conditions.for.stat.method) {
# pause for a while in this step
i = i + 1

# (i – 1) frames produced in the loop
ani.options(“nmax”) = i – 1

Whatever the method you follow, there is more power in animated graphics compared to static graphics. Go animaation! 

  • key references:


Google Maps – Fusion Tables – A Great Resource for Business Intelligence Developers

Google Fusion tables resources are phenomenal.

Every researcher or BI developer could benefit by this powerful tool.

What fascinated me is that Google already perfected the mapping algorithms, and has the most popular richest repository of mapping assets.

One may wonder, why bother.  After all the county maps, the most often used version of mapping is made into pulp by R developers.

I love R and I recommend R system, for lots of its wonderful functionality.  However, I would say, R has a long way to go, to own or translate the Google map functionality.

Perhaps you may want to just see all the counties with unemployment rate below 3%, a number considered to be full employment, or just counties that exceed unemployment rate more than 10%.  This is an example of counties with more than 10%. Some parts of Kentucky, Mississippi, California seem to be worst hit.

The beauty of google maps and fusion tables is that

  1. you are in the league of the best practices of the world and hence no worries about missing counties, old shape files, …
  2. you are using the full functionality of google map (zoom/real time data possibilities)
  3. your map works can tap into deeper levels of tiger files at all levels of data availability.

The key learning site you need to use are:

To bring together the shape files in one bundle in the right way for fusion tables to work, use the link

Have fun. It is a liberating feeling.  Phew!  Maps have been in my radar for a long time.  Waiting to identify the one that is needed at the foundation level so that the foundation best practices permeates at all levels of functionality is all the worth.

To complete the notes, I also want to bring the following to your attention – ggmap tutorial.  This is a great one, as long as you do not need the dynamic zooming facility.

Also, if you want to work with all types of shape files, it may be argued that you can do that with ggmap.  I find google maps and fusion tables more standardized and easier.

The quick start (cheat sheet) ggmap guide is this two page pdf.

Here is another blogger who uses ggmap with well articulated application.

More country level maps: