# Articles by is.R()

### To plot them is my real test

March 31, 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 ... [Read more...]

### MeRRy ChRistmas! (from is.R())

December 25, 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 ... [Read more...]

### Latent Class Analysis with poLCA

December 24, 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 ... [Read more...]

### Measuring the Gerrymander with spatstat

December 23, 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 ... [Read more...]

### The definitive guide to plotting confidence intervals in R

December 22, 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 ... [Read more...]

### Beautiful network diagrams with ggplot2

December 21, 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 ... [Read more...]

### Geocoding location data with dismo

December 20, 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 ... [Read more...]

### Finding Numeric Values of Strings using strsplit()

December 19, 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 ... [Read more...]

### Making prettier network graphs with sna and igraph

December 18, 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 ... [Read more...]

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

December 17, 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 ... [Read more...]

### Possibly slightly better text analysis with lme4

December 16, 2012 |

lme4 and its cousin arm are extremely useful for a huge variety of modeling applications (see Gelman and Hill’s book), but today we’re going to do something a little frivolous with them. Namely, we’re going to extend our Denver Debat... [Read more...]

### Text analysis made too easy with the tm package

December 15, 2012 |

Today’s Gist takes the CNN transcript of the Denver Presidential Debate, converts paragraphs into a document-term matrix, and does the absolute most basic form of text analysis: a raw word count. There are actually quite a few steps in this proc... [Read more...]

### Everything is a Network, featuring the sna package

December 14, 2012 |

We’ve gotten some requests, through the Ask us anything page, to do some plotting of networks. We may come back to this later, but today’s Gist shows how you can plot pretty much literally anything as a network. First, we go back to our [Read more...]

### Fuzzy clustering with fanny()

December 13, 2012 |

This is kind of a fun example, and you might find the fuzzy clustering technique useful, as I have, for exploratory data analysis. In this Gist, I use the unparalleled breakfast dataset from the smacof package, derive dissimilarities from breakfast it... [Read more...]

### Multidimensional metric unfolding with SMACOF

December 12, 2012 |

SMACOF stands for “Scaling by MAjorizing a COmplicated Function,” and it is a multidimensional scaling algorithm for metric unfolding of, among other things, rectangular ratings matrices. One neat Political Science application of MDS is i... [Read more...]

### US State Maps using map_data()

December 11, 2012 |

Today’s short post will show how to make a simple map using map_data(). Let’s assume you have data in a CSV file that may look like this: Notice the lower case state names; they will make merging the data much easier. The variable of inte... [Read more...]

### "Economics-style" graphs with bezier() from Hmisc

December 10, 2012 |

So, I really think this one is pretty cool. We spend much of our time in R making graphs with data, but what if you have a theory that you’d like to express graphically? Something like what I’ll call “economics-style” graphs, i... [Read more...]

### Handling missing data with Amelia

December 9, 2012 |

So, what if you have data, but some of the observations are missing? Many statistical techniques assume no missingness, so we might want to “fill in” or rectangularize our data, by replacing missing observations with plausible substitutes.... [Read more...]

### Evaluating term popularity with twitteR

December 8, 2012 |

I really wanted to put something together for this series on the twitteR package. Unfortunately, at the moment the number of interesting things than can be done with twitteR, as opposed to through API calls and RCurl, is limited. Regardless, I have Ye... [Read more...]

### Dot-density maps with spsample()

December 7, 2012 |

Today’s example is a little odd, in that the code isn’t pretty and the example isn’t really something you’d actually produce in real life — but if you’ll overlook those oddities, you’ll find that the spsample(... [Read more...]
1 2 3 4