Announcing the R Shapefile Contest

By on July 12th, 2016 in Blog

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!
Check out the R Shapefile contest! #rstats #gis #datascience Click To Tweet

*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.

25 thoughts on “Announcing the R Shapefile Contest

  1. kent37 says:

    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:

    1. Ari Lamstein says:

      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.

      1. kent37 says:

        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 🙂

  2. James B. Elsner says:

    Long term view of tornado risk in the United States.

    1. Ari Lamstein says:

      Fascinating topic!

  3. Ed says:

    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

    1. Ari Lamstein says:

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

  4. Robby says:

    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.

  5. Robby says:

    Here is my entry:

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

  6. jonocarroll says:

    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.

  7. Chris Brunsdon says:

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

  8. Dave says:


    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).

  9. Dennis Chandler says:

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

  10. Nikos Papakonstantinou says:

    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 :

  11. geoobserver says:

    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

  12. Parth Khare says:

    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.

    1. sarika says:

      nice work!

  13. Fung Yip says:

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

  14. Andrew Sajo says:

    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.

  15. Andrew Breza says:

    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.

  16. 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.

  17. Henry Partridge says:

    Hi Ari,

    My submission can be found here:

    The code is in a GitHub repo here:



  18. Twitter Sentiment analysis of Trump and Clinton

Comments are closed.