Blog Archives

To plot them is my real test

March 31, 2013
By
To plot them is my real test

I almost couldn’t bring myself to post this, but it’s April Fools’ Day, so I’ll never have a better opportunity. This Gist shows how to scrape “stats” and .PNG images from, erm, Bulbapedia, run a simple dimensionality reduction on those “stats,” and plot all 151 original Pokemon. I don’t know much about Pokemon, so I can’t vouch for...

Read more »

MeRRy ChRistmas!

December 25, 2012
By
MeRRy ChRistmas!

Merry Christmas is.R() readers! Thanks for accompanying us through an excellent first semester of R blogging, and for your feedback and enthusiasm. To celebrate, we’ve built an image mosaic from the shiny, happy avatars of our over 600 (!) Twitter followers.Click for a beautiful mosaic!We’ll be back in 2013 with...

Read more »

Latent Class Analysis with poLCA

December 24, 2012
By
Latent Class Analysis with poLCA

On an airplane the other day, I learned of a method called latent class (transition) analysis, and it sounded like an interesting thing to try in R. Of course, as with everything R, There is a Package for That, called poLCA, written by none other than Drew Linzer (of Votamatic fame) and Jeffrey Lewis. I...

Read more »

Measuring the Gerrymander with spatstat

December 23, 2012
By
Measuring the Gerrymander with spatstat

Well, to be specific, I mean measuring district compactness (a very interesting subject, see these three articles for starters). There are myriad ways of measuring the “oddness” of a shape, including a comparison of the area of the district to its circumcircle, the moment of inertia of the shape, the probability that a path connecting...

Read more »

The definitive guide to plotting confidence intervals in R

December 22, 2012
By
The definitive guide to plotting confidence intervals in R

Here at is.R(), we have produced countless posts that feature plots with confidence intervals, but apparently none of those are easy to find with Google. So, today, for the purposes of SEO, we’ve put “plotting confidence intervals” in the title of our post. We also cannot resist an earnest plea from our...

Read more »

Beautiful network diagrams with ggplot2

December 21, 2012
By
Beautiful network diagrams with ggplot2

I don’t usually like describing my own work as “beautiful,” but with your permission I will make an exception today. There have been some requests for scripts illustrating the plotting of network diagrams with ggplot2, and today (for the winter solstice) we’re bringing you a really nice-looking way of doing just that. In fact, this Gist...

Read more »

Geocoding location data with dismo

December 20, 2012
By
Geocoding location data with dismo

Today’s Gist could actually end up being very useful to a number of you. It’s something of a trumped-up example, but it illustrates in very simple code how to do three interesting things: Gather Tweets by search term (which we’ve done before), and look up user info for each of the users returned by that search. Convert textual user...

Read more »

Finding Numeric Values of Strings using strsplit()

December 19, 2012
By
Finding Numeric Values of Strings using strsplit()

Given a random list of words, can you find which has the lowest or highest numerical value when we apply a basic number:letter cipher?  A while back I asked David how he would solve this problem:  http://projecteuler.net/problem=42 Today’s post shows how to take a vector of words, parse them into each of the individual letters comprising the word, and...

Read more »

Making prettier network graphs with sna and igraph

December 18, 2012
By
Making prettier network graphs with sna and igraph

We’ve had some requests for ideas about how to make prettier network graphs, so here is one example, using the sna package for plotting, and the igraph package to calculate PageRank. The help file for gplot is pretty self-explanatory, but Melissa Clarkson has produced the most thorough and impressive guide for any R...

Read more »

The Inverse Herfindahl–Hirschman Index as an “Effective Number of” Parties

December 17, 2012
By
The Inverse Herfindahl–Hirschman Index as an “Effective Number of” Parties

I learned of the passing of Albert Hirschman on December 11, and while better and more instructive tributes to his life can be read elsewhere, I wanted to focus on a little piece of Hirschman’s work that I use all the time: the (inverse) Herfindahl–Hirschman Index. The HHI is basically a measure of market concentration, but...

Read more »