## Recreating Gapminder World Map with R & ggplot2

January 11, 2011
By

Gapminder has posted an interesting chart using world development indicators from the World Bank. I thought it would be a good exercise to recreate this chart using R and ggplot2. While playing with the data, not log transforming GDP provides some interesting, and perhaps different, interpretation. The R script and graphics are below. Google Gadget Version library(ggplot2)

## just for fun: Recovery.gov data snooping

January 11, 2011
By

Okay, so this isn't ecology related at all, but I like exploring data sets. So here goes...Propublica has some awesome data sets available at their website: http://www.propublica.org/tools/I played around with their data set on Recovery.gov (see hyperl...

## sab-R-metrics: Subsetting, Conditional Statements, ‘tapply()’, and VERY simple ‘for loops’

January 11, 2011
By

In my last sab-R-metrics post, I went over some basics of calling data and creating vectors or new data from those. Here, I want to extend that to full subsets of data and go on to use some of the basic functions in R so that we can begin plotting in the next tutorial.Before I begin, I...

## sab-R-metrics: Subsetting, Conditional Statements, ‘tapply()’, and VERY simple ‘for loops’

January 11, 2011
By

In my last sab-R-metrics post, I went over some basics of calling data and creating vectors or new data from those. Here, I want to extend that to full subsets of data and go on to use some of the basic functions in R so that we can begin plotting in the next tutorial.Before I begin, I...

## Emacs Starter Kit for the Social Sciences: Now Easier to Install

January 11, 2011
By

New in nerdery this week, it’s now a bit easier to install the Emacs Starter Kit for the Social Sciences that I put together (based on lots of great work by Phil Hagelberg and, more recently, Eric Schulte). In the past, the fact that AucTeX was both necessary and had to be compiled locally made

## Maps with R, part… n+1

January 11, 2011
By

Following the idea posted on James Cheshire's blog (here), I have tried to play a little bit with R and Google. And it works ! Consider for instance life expectancy at birth (that can be found - and downloaded - here). Using the following code, it ...

January 11, 2011
By

## Really useful bits of code that are missing from R

January 10, 2011
By

There are some pieces of code that are so simple and obvious that they really ought to be included in base R somewhere. Geometric mean and standard deviation – a staple for anyone who deals with lognormally distributed data. geomean <- function(x, na.rm = FALSE, trim = 0, ...) { exp(mean(log(x, ...), na.rm = na.rm,

## R interface to Google Chart Tools

January 10, 2011
By

Hans Rosling eat your heart out! It is now possible to interface R statistics software to Google’s Gapminder inspired Chart Tools. The plots below were produced using the googleVis R package and three datasets from the Gapminder website. The first shows the relationship between income, life expectancy and population for 20 countries with the highest ...