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.