Full Category Index

Posts in “R”

Fri, Oct 16, 2015

Using Containerized Travis-CI to check R in RMarkdown files

I’m teaching a short graduate seminar on Data Visualization with R this semester. Following Matt Salganik, I wanted students to be able to submit homework or other assignments as R Markdown files, but to have a way to make sure their R code passed some basic stylistic checks provided by lintr before they submitted it to me. Students write .Rnw files containing discussion or notes interspersed with chunks of R code.
Sat, May 9, 2015

Who Came Second in the UK Election?

The United Kingdom’s election results are being digested by the chattering classes. So, yesterday afternoon I thought I’d see if I could grab the election data to make some pictures. Because the ever-civilized BBC has election web pages with a sane HTML structure, this proved a lot more straightforward than I feared. (Thanks also in no small part to statistician Hadley Wickham’s rvest scraping library, alongside many other tools he has contributed to the community of social scientists who use R to do data analysis.) Here are two maps.
Thu, Jan 23, 2014

Plain Text, Papers, Pandoc

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.
Sun, Jun 9, 2013

Using Metadata to find Paul Revere

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”.
Tue, May 28, 2013

Updates to the Social Science Starter Kit

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.
Mon, Feb 25, 2013

Ten Things the Emacs Social Science Starter Kit gives you

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.
Mon, Apr 23, 2012

Updates to the Emacs Starter Kit for the Social Sciences

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.
Wed, Apr 18, 2012

Visualizing iOS Text Editors

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.
Fri, Jul 29, 2011

Text Editors in The Lord of the Rings

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.
Fri, Apr 1, 2011

Workflow Articles in "The Political Methodologist"

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.
Fri, Feb 18, 2011

Aligning labels in circular igraph layouts

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.
Tue, Jan 18, 2011

Workflow and the Emacs Starter Kit for the Social Sciences

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.
Tue, Jan 11, 2011

Emacs Starter Kit for the Social Sciences now gets ESS via ELPA

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.
Tue, Jan 11, 2011

Emacs Starter Kit for the Social Sciences: Now Easier to Install

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.
Mon, Oct 12, 2009

Make Shift-Enter do a lot in ESS

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.