Skip to content

Learning the Grammar of Graphics with R

During summer I usually spend a lot of hours locked up at an altitude of 30000+ feet, and this year I took ggplot2: Elegant Graphics for Data Analysis as reading material. ggplot2 is a data visualization package for the R statistical analysis platform. It is loosely based on “The Grammar of Graphics” from Leland Wilkinson, thus taking a different approach from traditional graphics packages by very explicitly mapping the data to aesthetic attributes (eg. colors) and geometric objects (eg. points).

Here is my first attempt to use the ggplot2 package. I was interested in the change of the mean population center of the US between 1790 and 2000, similar to the map that is put out by the Census Bureau, but specifically looking at the initially African, then African-American population.

I downloaded census data and county outlines from the National Historical Geographic Information System website, merged the data for each census year on the county level, and calculated the weighted mean for each census year. (Data are No TweetBacks yet. (Be the first to Tweet this post)

Categories: Noteworthy Bits.

Tags: ,

Comment Feed

No Responses (yet)



Some HTML is OK

or, reply to this post via trackback.