Building spatial objects with R

I started to work with geolocalized data some time ago. I had already performed basic spatial analysis but it was my (real) first steps in the wonderful world of Geographical Information Systems (GIS). I first used QGIS which is a pretty great (free!) tool to work with spatial data. However, I needed a more flexible tool and I decided to start learning how to perform spatial analysis with R. In this post I’m going to show you how to build and export spatial objects with R using the sp package. This package provides classes and methods for dealing with spatial data such as points, lines or polygons. We will focus on the creation of a spatial polygon that we will then export in shapefile format.

Log-log plots in R

Plotting data on log-log scale can be helpful when your data cover a large range of values and/or to detect power law behaviors in your data. Create such a plot in R is quite simple, you just have to add log = “xy” as parameter when you call the plot function. In the same way, you can use log = “x” or log = “y” to plot only the x-axis or the y-axis on log scale.