Blog Archives

Flexibly outlining a set of points with alphahull

December 6, 2012
By
Flexibly outlining a set of points with alphahull

We’ve previously covered the convex hull here at is.R(), and in that post I admitted that I was somewhat hard-pressed to come up with a common use-case — at least for Political Science applications. Well, today’s Gist illustrates the...

Read more »

APSRtable: Getting Tables from R to \( \LaTeX \)

December 5, 2012
By
APSRtable: Getting Tables from R to \( \LaTeX \)

Oftentimes you might be writing in LaTeX and trying to push your results from R into your .tex file. This, at times, can be very frustrating. Luckily, there’s apsrtable, an R package that automatically produces the LaTeX code for your  R model ...

Read more »

Reading/Writing Stata (.dta) files with Foreign

December 4, 2012
By
Reading/Writing Stata (.dta) files with Foreign

Oftentimes we find ourselves collaborating with others who might not use R or prefer to use Stata to clean and manage their data. Luckily, there is the foreign package that permits handling data of different types (SAS, SPSS, Stata, etc.) within the R...

Read more »

Scaling legislative roll call votes with wnominate

December 3, 2012
By
Scaling legislative roll call votes with wnominate

We’ve used NOMINATE scaling data before here at is.R(), but today’s Gist shows, in just a few lines of code, how to download up-to-date roll call data and run those votes through Keith Poole (et. al.)’s DW-NOMINATE procedure. It&#82...

Read more »

Rolling means (and other functions) with zoo

December 2, 2012
By
Rolling means (and other functions) with zoo

The zoo package is designed for use with (potentially irregular) time series data. It is widely used for any number of applications, but among its most frequently useful functions are the roll* functions, such as rollmean, rollmedian, rollmax, rollapp...

Read more »

Using XML to grab tables from the web

December 1, 2012
By
Using XML to grab tables from the web

We’re going to try, this December, to bring you an “Advent CalendaR,” for each of the 24 days leading up to Christmas. Each day, our hope is to unwrap a useful R package to show you a useful or interesting function inside! Today&#821...

Read more »

Finding a bright object

November 30, 2012
By
Finding a bright object

Finally, to return to the challenge I laid out in the first of this series on image manipulation in R: can we do anything as cool in R as can be done in Mathematica? Like, for example, this illustration of how to search images of the surface of Mars...

Read more »

Images as Voronoi tesselations

November 28, 2012
By
Images as Voronoi tesselations

This is probably the coolest-looking thing I’ve figured out how to do with raster images in R. Similar to (although not quite as impressive as) these images by Jeff Clark, I alter the simple k-means approach described in the previous post to...

Read more »

"Dominant" Color Palettes with k-means

November 27, 2012
By
"Dominant" Color Palettes with k-means

The idea of deriving color palettes from images has long been an interest of mine. There are places you can do this online, but it’s at least plausible that you might want to identify dominant colors programatically, for a large number of image...

Read more »

Image Manipulation in R, Part 1

November 26, 2012
By
Image Manipulation in R, Part 1

So, you know how to load PNG files, access their innards, and plot them as points in a scatter plot. But, is it possible to use R to do some of the awesome things you can do with Mathematica? Well, in this series of posts, I’ll introduce just ...

Read more »