It may be a cliché, but much of R’s utility comes from its amazing community. And by community, I am specifically referring to the bright, hard-working people who are willing to share their knowledge and code with the rest of us. Because of their contributions, we can do some amazingly cool and useful things with very little code of our own. It is in this context that I launch this new series to highlight packages and functions which make it easy to do jaw-droppingly cool and useful things.

First up: the googleVis package by Markus Gesmann and Diego de Castillo which makes it easy — often with just one-line of R — to harness the Google Visualization API. Annotated timelines, gauges, maps, org charts, tree maps, and more are suddenly at your command.

I’m going to focus on the motion chart, popularized by Hans Rosling in his groundbreaking 2006 TED talk on global economic development. (If you haven’t seen it yet, you should. Right now. Seriously. Go.) Motion charts are an innovative way to display multidimensional time series in an interactive way. And the googleVis package even comes with some sample data to make it even easier to try them out.

The package is available from CRAN if you need to install it.

To get started, load the package and the included “Fruits” data.frame:

library(googleVis)
data(Fruits)

This data.frame contains some sample data about sales of various fruits at different locations for different years. There’s even a proper Date column already constructed for us from the numeric Year column:

To make the chart, we need to give the gvisMotionChart() function our data.frame and tell it a few things about it: the column which identifies the items to examine (idvar=Fruit), the time dimension (timevar=Date), and optionally a name to use to identify the chart in the generated HTML and JavaScript (we’ll use chartid="ILoveFruits"):

I found some info on the custom fields plugin, but I got the impression it’s only available for self-hosted WordPress blogs. For once in my (IT) life, I’ve taken the easy route and am using WordPress.com’s hosted service. (That’ll teach me!) But I’m sure it will help the WordPress.org’ers out there!

That title is somehow misleading. That oneliner of R has a lot of lines of R, C, C++, or FORTRAN in the back.
It depends where the observer is positioned in the production chain between the final visualization and the raw data.

That’s a great point, but it’s also my point (which I could have made clearer): much of the power of R comes from the generous contributions of others in the community. What I like about R is that I can do very complicated, sophisticated, and cool things without having to do much (or any!) of the heavy lifting myself.