Publications by is.R()

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

17.12.2012

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 when inverted, it...

1877 sym 4 img

Making prettier network graphs with sna and igraph

18.12.2012

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 function I’ve ever seen, t...

1167 sym 4 img

Finding Numeric Values of Strings using strsplit()

19.12.2012

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 ...

945 sym 2 img

Geocoding location data with dismo

20.12.2012

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 location...

1310 sym 4 img

Beautiful network diagrams with ggplot2

21.12.2012

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 i...

1860 sym 4 img

The definitive guide to plotting confidence intervals in R

22.12.2012

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 Political Science colleagues, who man...

1137 sym 4 img

Measuring the Gerrymander with spatstat

23.12.2012

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 two ra...

1596 sym 4 img

Latent Class Analysis with poLCA

24.12.2012

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 wasn’t able to think of a good applicatio...

1532 sym 4 img

MeRRy ChRistmas! (from is.R())

25.12.2012

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 even more tut...

863 sym 2 img

To plot them is my real test

31.03.2013

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 vou...

888 sym 2 img