Summary
In this chapter, we closed the gap between the two main spatial data types (rasters and vector layers) that we dealt with separately in the previous three chapters. We now know how to make the conversion from a vector layer to raster and vice versa, and we can transfer the geometry and data components from one data model to another when the need arises. We also saw how raster values can be extracted from a raster according to a vector layer, a fundamental step in many analysis tasks involving raster data.
At this point, we conclude the review of basic spatial data analysis tool implementation in R. We now know how to work with—including import, transform, and combine in various ways—rasters and vector layers in R. In the next two chapters, examples of more specialized applications of R for spatial data analysis are going to be presented; specifically, spatial interpolation and visualization of spatial data.