Spatial data can be tricky. To help new users find their footing in spatial data analysis, I’ve written a handful of documents to help orient R users to the nuances of spatial data. For now, these tutorials reside on RPubs, a freely hosted site for R users to publish markdown documents.
See the listings below, or feel free to check out my RPubs for a full listing of the tutorial materials I have there.
Bringing Shapefiles into R
This tutorial breaks down the “shapefile” as a file format, and shows how to load polgyon shapefiles into R.
Polygons to Pixels
So, you have polygon data— but what if you want to represent that in a raster/pixel format? This goes through the nuts and bolts of how to think about polygon resampling, and one approach to do so.
The Scrambled Polygon Problem
An obnoxious quirk of the R SpatialPolygonsDataFrame objects is that the geometry is only affiliated with the attributes based on the ordering of the two “halves” of the spatial data lining up. If you undertake a base::merge() operation, sometimes, this order can be tampered with! This tutorial explains this problem in-depth and poses a few solutions and safeguards.