Posts in “R”
Over the past few months, I’ve had several people ask me about the tools I use to put papers together. I maintain a page of resources somewhat grandiosely headed “Writing and Presenting Social Science”. Really it just makes public some configuration files and templates for my text editor and related tools. Things have changed a little recently—which led to people asking the questions—so I will try to lay out the current setup here.
London, 1772. I have been asked by my superiors to give a brief demonstration of the surprising effectiveness of even the simplest techniques of the new-fangled Social Networke Analysis in the pursuit of those who would seek to undermine the liberty enjoyed by His Majesty’s subjects. This is in connection with the discussion of the role of “metadata” in certain recent events and the assurances of various respectable parties that the government was merely “sifting through this so-called metadata” and that the “information acquired does not include the content of any communications”.
The Emacs Social Science Starter Kit is a drop-in collection of packages and settings for Emacs 24 aimed at people like me: that is, people doing social science data analysis and writing, using some combination of tools like R, git, LaTeX, Pandoc, perhaps some other programming languages (e.g., Python, or Perl), and plain-text formats like Markdown, and Org-Mode. More information on the kit is available here. Some of its highlights are listed here.
I recently made some updates to the Emacs Social Science Starter Kit. I maintain the SSSK for my own convenience, but other people have found it useful as well. By now there are a lot of little bits and pieces in the kit, so I thought it might be useful to do a listicle highlighting some of the conveniences it offers. As a reminder, the motivation behind the kit was to allow researchers, faculty, and grad students working in the social sciences to get started with Emacs.
I’ve made some updates to the Emacs Starter Kit for the Social Sciences. The kit builds on Phil Hagelberg’s original and Eric Schulte’s org-mode version, and incorporates some packages and settings that are particularly useful for the social sciences. See the Starter Kit’s Homepage for more details. The new version requires Emacs 24, which is not quite officially released but is in very good shape. See the project page for more information about what’s included in the starter kit and how to install it.
The other day Brett Terpstra posted a gigantic and quite beautifully-executed feature comparison of all of the text editors available for iOS devices. The table is really terrific and also a bit overwhelming, as there’s so much data. On the bus home yesterday, it struck me that it might make for a nice data visualization exercise. There are all kinds of ways one might choose to represent the information, of course—how you visualize data depends on what you want to do with it.
Prompted by a passing thought about TextMate, I thought I’d make a comprehensive, accurate, unbiased, and irrefutable survey of text editors by way of comparison to locations in The Lord of the Rings. TextMate: Minas Tirith A once-great but now decaying city. Only the King has the power to renew it, but he is a long absent, indeed half-legendary figure—though there are persistent rumors that he is alive still in some distant land.
I’ve written a few times before about how to choose the software you work with, and what you should and should not care about when making those choices. I maintain a page with various resources related to this, if you’re interested, most notably the Emacs Starter Kit for the Social Sciences. A revised version of an article of mine on this topic called “Choosing Your Workflow Applications”, which I’ve had online for a while, has now been published in The Political Methodologist, the newsletter of the Society for Political Methodology.
The folks at IPE at UNC have produced this nice animated gif of some network data on increasing financial integration in the run-up to the 2008 crisis. They used a small trick I pointed to a while ago (just using a pipe, nothing fancy) that lets you generate the gif from within R without tediously typing in filenames. Then they ask, Also, a nerdy request: I wasn’t able to find a way to put the country labels outside the graph, next to the nodes.
Because the next official release of Emacs will finally have a built-in package management system, I’ve been able to update the Emacs Starter Kit for the Social Sciences to make it easier to set up. AucTeX is now installed directly as a package, and so is ESS. While the AucTeX package is official, I host the ESS package myself. I haven’t made any changes to ESS, just added a short .el file that the package manager needs.
More starter kit stuff. Up till now, the Emacs Starter Kit for the Social Sciences included ESS, but bundled it with the git repo. A better option would be to have it installed via the package mechanism, like AucTeX is now, but it’s not included. The ELPA system is allows you to specify repositories besides the official ones, so I’ve created a repository on my own site containing just ESS. I’ve updated the starter kit to include a pointer to it, so now on first install the kit will pull in ESS from there, and compile it for you.
New in nerdery this week, it’s now a bit easier to install the Emacs Starter Kit for the Social Sciences that I put together (based on lots of great work by Phil Hagelberg and, more recently, Eric Schulte). In the past, the fact that AucTeX was both necessary and had to be compiled locally made for some awkward steps in the installation. But AucTeX is now part of the new Emacs Package Manager, so it’s possible to install it automatically.
If you use Emacs and ESS to run R, then here’s a nice tweak I found on the Emacs Wiki. The following bit of elisp goes in your .emacs file (or equivalent). Starting with an R file in the buffer, hitting shift-enter vertically splits the window and starts R in the right-side buffer. If R is running and a region is highlighted, shift-enter sends the region over to R to be evaluated.