In this workshop we briefly describe and demonstrate how R can enable GIS analysis. We do not presume that all your GIS analytics can be accomplished via R. Nor do we presume that they cannot. Other tools such as QGIS, ArcGIS, and Carto.com are also quite popular. However, if you are already an R user, you will find the sf package is a very useful and tidy approach to reproducible GIS analytics.

## Reproducibility

As a blanket statement reproducibility is highly recommended. As a practical recommendation the more you produce your reports via the Tidy Data + Literate Code + R Markdown methods (i.e. tidyverse), the more likely you can transparently and openly reproduce your processes. As a side benefit you can reproduce variations on a thematic maps with minimal code.

One specific example of producing multiple maps would be to leverage the ggplot2 faceting features (facet_grid or facet_wrap). These functions enable production of multiple ggplot maps that differ by categorical or continuous variables.

The example on the right was produced with facet_wrap. You can find some documentation of this code in the Simple Features module.

## Design Best Practices

I will ask my colleague to write more on this topic

## Other Local Resources

We highly recommend the Student Association for Geospatial Analysis. Also, look for the R-Ladies RTP group. They do great work.

## Interactivity

Tools such as Shiny or HTML Widgets can be used in combination with dashboards. (e.g. In particular, Flexdashboard for R) can be leveraged to showcase interactivity of Shiny and HTML Widgets.

Of course, you may need hosting capabilities and Duke has some ready-made Shiny hosting and static-webpage hosting. (Remember that static webpages can still be interactive, especially when using HTML Widgets.) Alternatively, for hosting we’ve used a tool like netlify.com and found it very capable of hosting our static web presence.

## Shapefiles

Shapefiles are a staple of portable GIS data. In this course we give a cursory mention of the shapefile format. However, it’s important to highlight that the sf package can read and write shapefiles (or GeoJSON files, or a whole host of other formats). Our GIS Data: Starting Points guide provides a very handy collection of data sources, much of which will be in the shapefiles format. Consider consulting with our GIS experts in the DVS Department for information about sources of shapefiles.

## Raster

There are many more advanced things to learn about GIS analysis in R. One of the most common questions is how to handle Raster files. It’s definitely possible and we hope to offer a workshop about this. In the meantime look into: