Publications by Christopher Gandrud

Update to Graphing Non-Proportional Hazards in R

30.12.2012

Update 1 February 2013: I’ve moved all of the functionality described in this post into an R package called simtvc. Have a look. It is much easier to use. This is a quick update for a previous post on Graphing Non-Proportional Hazards in R. In the previous post I showed how to simulate and graph 1,000 non-proportional hazard ratios at roughl...

1750 sym R (369 sym/1 pcs) 2 img

source_GitHubData: a simple function for downloading data from GitHub into R

06.01.2013

Update 31 January: I’ve folded source_GitHubData into the repmis packaged. See this post. Update 7 January 2012: I updated the internal workings of source_GitHubData so that it now relies on httr rather than RCurl. Also it is more directly descended from devtool‘s source_url command. This has two advantages. Shortened URL’s can be used ...

1858 sym R (459 sym/1 pcs)

repmis: misc. tools for reproducible research in R

30.01.2013

I’ve started to put together an R package called repmis. It has miscellaneous tools for reproducible research with R. The idea behind the package is to collate commands that simplify some of the common R code used within knitr-type reproducible research papers. It’s still very much in the early stages of development and has two commands: Load...

2025 sym R (155 sym/1 pcs)

InstallOldPackages: a repmis command for installing old R package versions

03.02.2013

A big problem in reproducible research is that software changes. The code you used to do a piece of research may depend on a specific version of software that has since been changed. This is an annoying problem in R because install.packages only installs the most recent version of a package. It can be tedious to collect the old versions. On Toby ...

1370 sym R (694 sym/2 pcs)

FillIn: a function for filling in missing data in one data frame with info from another

15.02.2013

Sometimes I want to use R to fill in values that are missing in one data frame with values from another. For example, I have data from the World Bank on government deficits. However, there are some country-years with missing data. I gathered data from Eurostat on deficits and want to use this data to fill in some of the values that are missing fr...

2077 sym R (696 sym/3 pcs)

Dropbox & R Data

11.04.2013

I'm always looking for ways to download data from the internet into R. Though I prefer to host and access plain-text data sets (CSV is my personal favourite) from GitHub (see my short paper on the topic) sometimes it's convenient to get data stored on Dropbox. There has been a change in the way Dropbox URLs work and I just added some functionali...

2739 sym R (499 sym/2 pcs)

Reinhart & Rogoff: Everyone makes coding mistakes, we need to make it easy to find them + Graphing uncertainty

17.04.2013

You may have already seen a lot written on the replication of Reinhart & Rogoff’s (R &amp R) much cited 2010 paper done by Herndon, Ash, and Pollin. If you haven’t, here is a round up of some of some of what has been written: Konczal, Yglesias, Krugman, Cowen, Peng, FT Alphaville. This is an interesting issue for me because it involves three ...

7440 sym 6 img

Slide: one function for lag/lead variables in data frames, including time-series cross-sectional data

21.05.2013

I often want to quickly create a lag or lead variable in an R data frame. Sometimes I also want to create the lag or lead variable for different groups in a data frame, for example, if I want to lag GDP for each country in a data frame. I've found the various R methods for doing this hard to remember and usually need to look at old blog posts. An...

2280 sym R (983 sym/4 pcs)

Quick and Simple D3 Network Graphs from R

08.06.2013

Sometimes I just want to quickly make a simple D3 JavaScript directed network graph with data in R. Because D3 network graphs can be manipulated in the browser–i.e. nodes can be moved around and highlighted–they're really nice for data exploration. They're also really nice in HTML presentations. So I put together a really bare-bones simple f...

1952 sym R (341 sym/3 pcs) 2 img

Getting Started with Reproducible Research: A chapter from my new book

15.07.2013

This is an abridged excerpt from Chapter 2 of my new book Reproducible Research with R and RStudio. It’s published by Chapman & Hall/CRC Press. You can purchase it on Amazon. “Search inside this book” includes a complete table of contents. Researchers often start thinking about making their work reproducible near the end of the research pr...

9940 sym 4 img