Why R as GIS for Economists?

R has extensive capabilities as GIS software. In my opinion, \(99\%\) of your spatial data processing needs as an economist will be satisfied by R. But, there are several popular options for GIS tasks other than R:

  • Python
  • ArcGIS
  • QGIS

Here, I compare them briefly and discuss why R is a good option.

R vs Python

Both R and Python are actually heavily dependent on open source software GDAL and GEOS for their core GIS operations (GDAL for reading spatial data, and GEOS for geometrical operations like intersecting two spatial layers).1 So, when you run GIS tasks on R or Python you basically tell R or Python what you want to do and they talk to the software, let it do the job, and return the results to you. This means that R and Python are not much different in their capability at GIS tasks as they are dependent on the common open source software for many GIS tasks. When GDAL and GEOS get better, R and Python get better (with a short lag all thanks to those who make updates available on R). Both of them have good spatial visualization tools as well. Moreover, both R and Python can communicate with QGIS and ArcGIS (as long you as have them installed of course) and use their functionalities from within R and Python via the bridging packages: RQGIS and PyQGIS for QGIS, and R-ArcGIS and ArcPy.2 So, if you are more familiar with Python than R, go ahead and go with Python. From now on, my discussions assume that you are going for the R option, as otherwise, you would not be reading the rest of the book anyway.

R vs ArcGIS or QGIS

ArcGIS is commercial software and it is quite expensive (you are likely to be able to get a significant discount if you are a student at or work for a University). On the other hand, QGIS is open source and free. It has seen significant developments over the decade, and I would say it is just as competitive as ArcGIS. QGIS also uses open source geospatial software GDAL, GEOS, and others (SAGA, GRASS GIS). Both of them have a graphical interface that aids you implement various GIS tasks unlike R which requires programming.

Now, since R can use ArcGIS and QGIS through the bridging packages, a more precise question we should be asking is whether you should program GIS tasks using R (possibly using the bridging packages) or manually implement GIS tasks using the graphical interface of ArcGIS or QGIS. The answer is programming GIS tasks using R. First, manual GIS operations are hard to repeat. It is often the case that in the course of a project you need to redo the same GIS task except that the underlying datasets have changed. If you have programmed the process with R, you just run the same code and that’s it. You get the desired results. If you did not program it, you need to go through many clicks on the graphical interface all over again, potentially trying to remember how you actually did it the last time.3 Second and more important, manual operations are not scalable. It has become much more common that we need to process many large spatial datasets. Imagine you are doing the same operations on \(1,000\) files using a graphical interface, or even \(50\) files. Do you know what is good at doing the same tasks over and over again without complaining? A computer. Just let it do what it likes to do. You have better things do.

Finally, should you learn ArcGIS or QGIS in addition to (or before) R? I am doubtful. As economists, the GIS tasks we need to do are not super convoluted most of the time. Suppose \(\Omega_R\) and \(\Omega_{AQ}\) represent the set of GIS tasks R and \(ArcGIS/QGIS\) can implement, respectively. Further, let \(\Omega_E\) represent the set of skills economists need to implement. Then, \(\Omega_E \in \Omega_R\) \(99\%\) (or maybe \(95\%\) to be safe) of the time and \(\Omega_E \not\subset \Omega_{AQ}\setminus\Omega_R\) \(99\%\) of the time. Personally, I have never had to rely on either ArcGIS or QGIS for my research projects after I learned how to use R as GIS.

One of the things ArcGIS and QGIS can do but R cannot do (\(\Omega_{AQ}\setminus\Omega_R\)) is create spatial objects by hand using a graphical user interface, like drawing polygons and lines. Another thing that R lags behind ArcGIS and QGIS is 3D data visualization. But, I must say neither of them is essential for economists at the moment. Finally, sometime it is easier and faster to make a map using ArcGIS and QGIS especially for a complicated map.4

Using R as GIS, however, comes with a learning curve for those who have never used R because basic knowledge of R and general programming knowledge is required. On the other hand, the GUI-based use of ArcGIS and QGIS has a very low start-up cost. For those who have used R for other purposes like data wrangling and regression analysis, you have already (or almost) climbed up the hill and are ready to learn how to use R as GIS.

Summary

  • You have never used any GIS software, but are very comfortable with R?

Learn how to use R as GIS first. If you find out you really cannot complete the GIS tasks you would like to do using R, then turn to other options.

  • You have never used any GIS software and R?

This is tough. If you expect significant amount of GIS work, learning R basics and how to use R as GIS is a good investment of your time.

  • You have used ArcGIS or QGIS and do not like them because they crash often?

Why don’t you try R?5 You may realize you actually do not need them.

  • You have used ArcGIS or QGIS before and are very comfortable with them, but you need to program repetitive GIS tasks?

Learn R and maybe take advantage of R-ArcGIS or RQGIS, which this book does not cover.

  • You know for sure that you need to run only a simple GIS task once and never have to do any GIS tasks ever again?

Stop reading and ask one of your friends to do the job. Pay him/her \(\$20\) per hour, which is way below the opportunity cost of setting up either ArcGIS or QGIS and learning to do that simple task.


  1. For example, see the very first sentence of this page↩︎

  2. We do not learn them in this lecture note because I do not see much benefits of using them.↩︎

  3. You could take a step-by-step note of what you did though.↩︎

  4. Let me know if you know something that is essential for economists that only ArcGIS or QGIS can do. I will add that to the list here.↩︎

  5. I am not saying R does not crash. R does crash. But, often times, the fault is yours, rather than the software’s.↩︎