The Armed Conflict Location & Event Data Project, a.k.a. ACLED, produces up-to-date event data on certain kinds of political conflict in Africa and, as of 2015, parts of Asia. In this post, I’m not going to dwell on the project’s sources and methods, which you can read about on ACLED’s About page, in the 2010 journal article that introduced the project, or in the project’s user’s guides. Nor am I going to dwell on the necessity of using all political event data sets, including ACLED, with care—understanding the sources of bias in how they observe events and error in how they code them and interpreting (or, in extreme cases, ignoring) the resulting statistics accordingly.

Instead, my only aim here is to share an R script I’ve written that largely automates the process of downloading and merging ACLED’s historical and current Africa data and then creates a new data frame with counts of events by type at the country-month level. If you use ACLED in R, this script might save you some time and some space on your hard drive.

You can find the R script on GitHub, here.

The chief problem with this script is that the URLs and file names of ACLED’s historical and current data sets change with every update, so the code will need to be modified each time that happens. If the names were modular and the changes to them predictable, it would be easy to rewrite the code to keep up with those changes automatically. Unfortunately, they aren’t, so the best I can do for now is to give step-by-step instructions in comments embedded in the script on how to update the relevant four fields by hand. As long as the basic structure of the .csv files posted by ACLED doesn’t change, though, the rest should keep working.

[UPDATE: I revised the script so it will scrape the link addresses from the ACLED website and parse the file names from them. The new version worked after ACLED updated its real-time file earlier today, when the old version would have broken. Unless ACLED changes its file-naming conventions or the structure of its website, the version should work for the rest of 2015. In case it does fail, instructions on how to hard-code a workaround are included as comments at the bottom of the script.]

It should also be easy to adapt the part of the script that generates country-month event counts to slice the data even more finely, or to count by something other than event type. To do that, you would just need to add variables to the group_by() part of the block of code that produces the object For example, if you wanted to get counts of events by type at the level of the state or province, you would revise that line to read group_by(gwno, admin1, year, month, event_type). Or, if you wanted country-month counts of events by the type(s) of actor involved, you could use group_by(gwno, year, month, interaction) and then see this user’s guide to decipher those codes. You get the drift.

The script also shows a couple of examples of how to use ‘gglot2’ to generate time-series plots of those monthly counts. Here’s one I made of monthly counts of battle events by country for the entire period covered by ACLED as of this writing: January 1997–June 2015. A production-ready version of this plot would require some more tinkering with the size of the country names and the labeling of the x-axis, but the kind of small-multiples chart offers a nice way to explore the data before analysis.

Monthly counts of battle events, January 1997-June 2015

Monthly counts of battle events, January 1997-June 2015

If you use the script and find flaws in it or have ideas on how to make it work better or do more, please email me at ulfelder <at> gmail <dot> com.

Leave a comment


  1. I wonder if this counts as ‘scientism’? I’m rather curious what the purpose of this software is.

    • When you say “this software”, what do you mean? The script I’ve written? R? ACLED is producing data, not software, but maybe that’s what you have in mind?

      Whatever you meant, I can be clearer about my goals here: ACLED is a source of information about certain kinds of political violence in Africa. Many of my work projects focus on forecasting and explaining trends in political violence, so ACLED is sometimes useful to me. The script I have written can save me time and frustration on some of those projects by making it easier to get and manipulate ACLED’s data. I know there are many other researchers in the same boat, so I shared the script to help save them time and frustration, and to demonstrate to potential clients that I can write code to do these kinds of tasks.

  2. Thanks for taking the time to explain. I have some family connections with Africa and have maintained a faint interest in the continent, but I have not followed much closely. So is there a particular hypothesis you are testing? I dpn’t really understand the benefits of aggregating data, are you looking for some pattern. My own field of research esxperince, in the past was biomedical, so I’m no expert I what you are doing.

  3. I’ve been reading the linked site, so I see its essentially a database with a system of graphical data presentation. Well I suppose it ought to be useful. I have to admit to being suspicious of quantitative approaches towards analysing what seem to me qualitative issues. I would have thought that political stability is a reflection of the structure of a society and polity which is difficult to quantify in any meaningful way.

  4. cmohamma

     /  July 21, 2015

    Thanks for this, it does save a lot of us time! And a h/t to Hadley Wickham for making everyone’s life easier with dplyr.

  1. Nigeria – Early Warning Project question

Leave a Comment

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

  • Author

  • Follow me on Twitter

  • Follow Dart-Throwing Chimp on
  • Enter your email address to follow this blog and receive notifications of new posts by email.

    Join 13,609 other subscribers
  • Archives

%d bloggers like this: