This is the core function within the package for areal weighted interpolation. It validates both data sources before interpolating one or more listed values from the source data into the target data.

aw_interpolate(.data, tid, source, sid, weight = "sum", output = "sf", extensive,
intensive)

## Arguments

.data A sf object that data should be interpolated to (this is referred to as the target elsewhere in the package). A unique identification number within target A sf object with data to be interpolated A unique identification number within source For "extensive" interpolations, should be either "total" or "sum". For "intensive" interpolations, should be "sum". For mixed interpolations, this will only impact the calculation of the extensive variables. One of either "sf" or "tibble" A vector of quoted variable names to be treated as spatially extensive (e.g. population counts); optional if intensive is specified A vector of quoted variable names to be treated as spatially intensive (e.g. population density); optional if extensive is specified

## Value

A sf object or a tibble with the value or values interpolated into the target data.

## Details

Areal weighted interpolation can be used for generating demographic estimates for overlapping but incongruent polygon features. It assumes that individual members of a population are evenly dispersed within the source features (an assumption not likely to hold in the real world). It also functions best when data are in a projected coordinate system, like the UTM coordinate system.

## Examples

aw_interpolate(ar_stl_wards, tid = WARD, source = ar_stl_race, sid = GEOID, weight = "sum",
output = "sf", extensive = "TOTAL_E")#> Simple feature collection with 28 features and 4 fields
#> geometry type:  POLYGON
#> dimension:      XY
#> bbox:           xmin: 733361.8 ymin: 4268336 xmax: 746157.7 ymax: 4295504
#> projected CRS:  NAD83 / UTM zone 15N
#> First 10 features:
#>    OBJECTID WARD      AREA   TOTAL_E                       geometry
#> 1         1    1  46138761  7991.565 POLYGON ((740184.2 4286431,...
#> 2         2    2 267817711 12145.021 POLYGON ((742392.1 4289178,...
#> 3         3    3  66291644  7344.287 POLYGON ((742956.1 4284113,...
#> 4         4    4  53210707  8457.672 POLYGON ((739557.6 4284080,...
#> 5         5    5  60462396  8783.377 POLYGON ((744883.8 4281632,...
#> 6         6    6  64337271 14050.399 POLYGON ((742501.6 4279976,...
#> 7         7    7 101268146 15840.086 POLYGON ((745618.6 4279867,...
#> 8         8    8  45966410 12188.131 POLYGON ((739842.8 4277724,...
#> 9         9    9  73993891 14217.149 POLYGON ((742619.4 4276734,...
#> 10       10   10  62915358 11239.213 POLYGON ((737257.7 4277050,...
aw_interpolate(ar_stl_wards, tid = WARD, source = ar_stl_asthma, sid = GEOID, weight = "sum",
output = "tibble", intensive = "ASTHMA")#> # A tibble: 28 x 4
#>    OBJECTID  WARD       AREA ASTHMA
#>       <dbl> <int>      <dbl>  <dbl>
#>  1        1     1  46138761.  13.4
#>  2        2     2 267817711.  13.2
#>  3        3     3  66291644.  14.1
#>  4        4     4  53210707.  13.6
#>  5        5     5  60462396.  13.8
#>  6        6     6  64337271.  11.7
#>  7        7     7 101268146.   9.72
#>  8        8     8  45966410.   9.82
#>  9        9     9  73993891.  11.8
#> 10       10    10  62915358.   9.44
#> # … with 18 more rows