1.4 R’s spatial ecosystem

There are many ways to handle geographic data in R, with dozens of packages in the area.4In this book we endeavor to teach the state-of-the-art in the field whilst ensuring that the methods are future-proof.Like many areas of software development, R’s spatial ecosystem is rapidly evolving (Figure 1.2).Because R is open source, these developments can easily build on previous work, by ‘standing on the shoulders of giants’, as Isaac Newton put it in 1675.This approach is advantageous because it encourages collaboration and avoids ‘reinventing the wheel’.The package sf (covered in Chapter 2), for example, builds on its predecessor sp.

A surge in development time (and interest) in ‘R-spatial’ has followed the award of a grant by the R Consortium for the development of support for Simple Features, an open-source standard and model to store and access vector geometries.This resulted in the sf package (covered in Section 2.2.1).Multiple places reflect the immense interest in sf. This is especially true for the R-sig-Geo Archives, a long-standing open access email list containing much R-spatial wisdom accumulated over the years.

The popularity of spatial packages in R. The y-axis shows average number of downloads per day, within a 30-day rolling window, of prominent spatial packages.
Figure 1.2: The popularity of spatial packages in R. The y-axis shows average number of downloads per day, within a 30-day rolling window, of prominent spatial packages.

It is noteworthy that shifts in the wider R community, as exemplified by the data processing package dplyr (released in 2014) influenced shifts in R’s spatial ecosystem.Alongside other packages that have a shared style and emphasis on ‘tidy data’ (including, e.g., ggplot2), dplyr was placed in the tidyverse ‘metapackage’ in late 2016.The tidyverse approach, with its focus on long-form data and fast intuitively named functions, has become immensely popular.This has led to a demand for ‘tidy geographic data’ which has been partly met by sf and other approaches such as tabularaster.An obvious feature of the tidyverse is the tendency for packages to work in harmony.There is no equivalent geoverse, but there are attempts at harmonization between packages hosted in the r-spatial organization and a growing number of packages use sf (Table 1.2).

Table 1.2: The top 5 most downloaded packages that depend on sf, in terms of average number of downloads per day over the previous month. As of 2019-03-08 there are 128 packages which import sf.
packageDownloads
ggplot225678
plotly5171
raster3033
leaflet1609
spdep1441