Announcing the R Shapefile Contest

Today I am happy to announce the R Shapefile Contest. The goal of the contest is to encourage and promote high quality work at the intersection of R and GIS (Geographic Information Systems). The winner of the contest will:

  1. Get featured prominently on my blog
  2. Get a free copy of my course Mapmaking in R with Choroplethr (a $99 value)
  3. Get a free copy of my course Shapefiles for R Programmers (a $99 value)

In many ways this contest is a follow up to the R Election Analysis Contest (1, 2), which I ran in March, and was the first contest that I ran. That contest was so successful that I decided to run another one!

Why a contest?

Over the last few years I’ve written several R packages, and published several analyses, that use R and shapefiles to make choropleth maps. While I’m happy with this work, I also feel that making choropleth maps is only a sliver of what R can do with shapefiles. I’m creating this contest specifically to promote analyses in R that use shapefiles to do something other than create choropleth maps.

For reference, here is a sample of choropleth maps that I’ve created in the last year:

If you’d like to learn more about this area, and get a feel for the kind of analyses that are possible, then I recommend these two books:

  1. Applied Spatial Data Analysis in R
  2. An Introduction to R for Spatial Analysis and Mapping

How do I enter?

Entering the contest is easy. Just:

  1. Publish an analysis online between today (7/12/16) and Friday July 29, 2016.
  2. The analysis must use R and do something with a shapefile* other than make a choropleth map. (It’s fine if the analysis includes a choropleth map, but it has to so something else as well!)
  3. Leave a comment on this page with a description and link to your entry. I will personally read each entry.

Regarding publishing your entry: If you don’t have a blog of your own, you can use rPubs, which is free.

Your entry must contain code that works and use data that other people can load. Think of yourself as both writing an analysis and teaching other people how you did it.

I will announce the winner on my blog on Monday, August 1 2016.


  1. Can I submit more than one analysis? Yes.
  2. Can I enter as a group? Yes. In the case that everyone in the group will win get their own copy of the courses.
  3. Do you have any suggestions for analyses to do? Do something that you find personally interesting! If you find it interesting, then the odds are that other people will too!
  4. I’m worried that my analysis won’t be good enough! A major goal of the contest is to encourage people to “learn by doing”. Don’t worry about winning the Nobel prize in R.
  5. I have another question. Contact me via my contact page.

How can I help?

Besides submitting an entry, the best way to support the contest is to raise awareness of it. Some easy ways to do that are:

  1. Click the “share” buttons below to share news about the contest.
  2. Click the link below!
[bctt tweet=”Check out the R Shapefile contest! #rstats #gis #datascience” username=”arilamstein”]

*Update (7/14/2016):

A few people have asked if they can submit entries that use the GeoPackage format rather than the Shapefile format. The answer is yes: any file format is fine. The intent of the contest is simply to raise awareness of using R for a broad array of geospatial analysis tasks. The reason why I named the contest the “R Shapefile Contest” is that, at the time of writing, I was only aware of the Shapefile format.

kent37 says July 12, 2016

Not sure if there is a requirement to include source code; here is an RMarkdown document showing a map of proposed zoning in Cambridge, Mass:

    Ari Lamstein says July 13, 2016

    Thank you and congratulations on being the first entry! Yes, it would be great if you could include source code. A big motivator for the contest is to help people learn from the submissions.

      kent37 says July 13, 2016

      I updated it to use flexdashboard with a source link in the header bar. The layout is not quite as nice but there is source 🙂

James B. Elsner says July 13, 2016

Long term view of tornado risk in the United States.

    Ari Lamstein says July 13, 2016

    Fascinating topic!

Ed says July 13, 2016

I’m a newbie in R and i’m interested in making/using chloropeth maps and GIS. I was in a conference yesterday sponsored by USAID and because our country is one of the most likely places to be affected by climate change and rapid urban development, i’d like to learn more. Can i stick around and see the works submitted and if you can recommend the best way for me to start learning. Thanks

    Ari Lamstein says July 13, 2016

    Sure. As a starting point, I recommend taking my free course: Learn to Map Census Data in R.

rlpj4 says July 21, 2016

Here is my answer to this contest. I have hosted it at github at the following location:

In this document, I look at the effect of airports on county unemployment rates.

rlpj4 says July 21, 2016

Here is my entry:

I look at how the proximity of airports affects county unemployment rates.

jonocarroll says July 25, 2016

The major components of my analysis are complete, so I’ll submit my entry now: analysing the 2016 Australian Federal Election (just completed) with a comparison between the results at each individual polling place and the eventual winner for that electorate shows how polarised each electorate is, and the finer-scale politics that get washed out by the overall result.

The shapefile involved is the electorate boundaries which I’ve merged with polling booth results to shade by overall winner, with individual polling places colored by which party had the most votes at that booth (only total votes across the electorate actually count). This is obviously skewed by how many people vote at each booth (only electorates are consistent in population count) so I’ve included the number of votes at each booth as a separate plot.

I’m still waiting for some data to be uploaded by the electoral commission (the counts are complete but not yet available) so I’ll continue to update the page with newer data. A blog post will follow ( once it’s all ready. Source available via the flexdashboard link and will be copied over to GitHub shortly.

tgrg says July 27, 2016

Here’s my entry:
And associated paper:

Chris Brunsdon says July 27, 2016

Not sure whether this is eligible for the competition, but it might be of interest:

Dave says July 27, 2016


The purpose of the document is to analyze spatial point patterns using the Spatstat package and then convert the output into a shapefile for use in other programs (Spotfire, Tableau, etc).

Dennis Chandler says July 27, 2016

Here’s how I’ve been playing with shapefiles recently:

Nikos Papakonstantinou says July 27, 2016

This is a recent project about Crimes in Greece during 2010 (the most recent available data). The whole project is available here :
The application also can be found directly here :

geoobserver says July 28, 2016

The shortest script in the contest? 😉

Maybe the shortest script in this contest. Short but effective. It is helpful for simply getting annoying tasks done. With just a few lines of code! It generates n thematic maps from n data columns from a shapefile into a PDF. Columns with not available values (NA) are sorted out. Code and data have to be in the same folder (here in „.“). The output-PDF is also generated in this folder. The example-data are from the OpenData-Server from the city Halle ( They were adjusted with QGIS. All columns with „*_t“ contain values as strings. Columns with „*_n“ contain numerical values. This points out differences in classifications.
The code should be adjusted and optimized on demand, e. g. by classifications. Code and data can be found at Have fun testing it.

by Mike Elstermann alias geoObserver @mikee63

Parth Khare says July 28, 2016

Great to learn from a compiled repository of work. My submission is on Delhi Spatial Crime Maps and is built using R, Shiny and Leaflet.

Delhi’s state of crime has translated into an unfortunate adage: Delhi is state of crime.
We learn from history and data that there is iterated pattern signals us deconstructing causes and so move from curative to preventive action.

Brief description of the submission:
Open source data from WorldPop and Night Light radiance (NASA) was conjoined with Crime Statistics by police stations.
The full map is a culmination of integrating micro satellite data and integrating it with event based data. Goe-coding police station in Delhi the features are overlayed through 5 layers. There is additional information on number of police personnel deployed and sanctioned per police station so juxtaposing it with crime incident and population density can help in quick and efficient disbursal. Delhi and India by and large follows overlapping system of administrative boundaries, therefore I have stuck to creating customized Vornoi (Voronoi diagram is a partitioning of a plane into regions based on distance to points in a specific subset of the plane) boundaries. In essence the spatial and event based (converted into spatial data) was integrated together by a uniform spatial resolution. The meta data was then rasterized and condensed into a rasterBrick which is used by the slider panel in Shiny.

    sarika says August 2, 2016

    nice work!

Fung Yip says July 28, 2016

Here is my entry:
Hong Kong Population Center of Gravity (COG)

Andrew Sajo says July 28, 2016

Here are my submissions:
1) Overview of ground-based rainfall measurement network data quality for Venezuela:

2) Venezuelan rainfall dynamics:


Both submissions where built using the vetools R package and shapefiles of Venezuela.

Andrew Breza says July 28, 2016

Here’s an analysis of all the parking tickets issued in Washington DC in April of this year:

I demonstrate several ways of examining data from a shapefile, including simple visualization and more advanced analysis. All of my data and code are available on Github and my analysis is completely reproducible.

Daniel Palacios says July 28, 2016

Here’s my submission:
Title: Marine Boundaries in R: Reading EEZ Shapefiles
Description: How to read ESRI shapefiles of the Exclusive Economic Zone (EEZ) in R, including visualization and a basic analytical application.

Henry Partridge says July 29, 2016

Hi Ari,

My submission can be found here:

The code is in a GitHub repo here:



Charlie Thompson says July 29, 2016

Twitter Sentiment analysis of Trump and Clinton

Comments are closed