Areal interpolation is the process making estimates from a source set of polygons to an overlapping but incongruent set of target polygons. One challenge with areal interpolation is that, while the processes themselves are well documented in the academic literature, implementing them often involves “reinventing the wheel.” While the R package sf does offer a basic interface for areal weighted interpolation (st_interpolate_aw), it lacks some features that we use in our work. The areal package contains a suite tools for validation and estimation, providing a full-featured workflow that fits into both modern data management (e.g. tidyverse) and spatial data (e.g. sf) frameworks.

Bug Fixes in v0.1.4

There are two additional bug fixes in v0.1.4:

  1. Data that do not require being converted back from a geometry collection (see #2 in the next section) were still being processed through this code, making runtimes longer than necessary. This has been fixed.
  2. Mixed interpolations with multiple extensive and intensive variables would get incorrect output containing two copies of the extensive results. This has been fixed, and the simplest workaround is to install the development version of areal from GitHub.

Bug Fixes in v0.1.3

The initial CRAN release contains four known bugs (see Issues 6, 7, 14, and 16), all of which are fixed on the current GitHub master branch:

  1. If the tid and sid column names are identical, the interpolated column created by aw_interpolate() will consist of all NA values. The simplest workaround is to rename either tid or sid before executing aw_interpolate(). Alternatively, you can install the development version of areal from GitHub.
  2. Some intersections of sf geometries will result in geometry collections being created. This appears to be an infrequent issue, but it will result in an error when aw_interpolate() is executed. The error will begin with Warning in st_cast.GEOMETRYCOLLECTION(X[[i]], ...). The simplest workaround is to install the development version of areal from GitHub.
  3. Interpolation fails if the sf geometry column is not named geometry. The simplest workaround is to either rename the column to geometry before executing aw_interpolate(). Alternatively, you can install the development version of areal from GitHub.
  4. Interpolation with output = "tibble" only returns the identification number and the estimated value. If you want other variables from the target data, the simplest workaround is to join the output to the original target data. Alternatively, you can install the development version of areal from GitHub.

Big thanks to early adopter Matt Herman for catching the first two and David Blodgett for catching the third!

Quick Start

If the sf package is already installed, the easiest way to get areal is to install it from CRAN:

Alternatively, the development version of areal can be accessed from GitHub with remotes:

Additional details, including some tips for installing sf, can be found in the Get started article.

Resources

In addition to instructions for installation, the main Get started article has:

  • a quick overview of areal interpolation,
  • some notes on preparing data for interpolation,
  • a brief introduction to the aw_interpolate() function,
  • tips for getting help and submitting feedback,
  • and the areal package’s development roadmap!

This site also offers dedicated articles on data preparation and using areal for areal weighted interpolation.