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).

tid

A unique identification number within target

source

A sf object with data to be interpolated

sid

A unique identification number within source

weight

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.

output

One of either "sf" or "tibble"

extensive

A vector of quoted variable names to be treated as spatially extensive (e.g. population counts); optional if intensive is specified

intensive

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.

See also

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
#> Bounding box:  xmin: 265638 ymin: 299436.3 xmax: 278974.9 ymax: 326430.3
#> Projected CRS: NAD_1983_HARN_StatePlane_Missouri_East_FIPS_2401
#> First 10 features:
#>    OBJECTID WARD      AREA   TOTAL_E                       geometry
#> 1         1    1  46138761  7959.092 POLYGON ((272762.8 317484.8...
#> 2         2    2 267817711 12110.535 POLYGON ((275044.1 320169.6...
#> 3         3    3  66291644  7356.539 POLYGON ((275469.4 315093.9...
#> 4         4    4  53210707  8457.699 POLYGON ((272072.6 315153.2...
#> 5         5    5  60462396  8807.580 POLYGON ((277328.1 312562.2...
#> 6         6    6  64337271 14052.998 POLYGON ((274902.5 310971.6...
#> 7         7    7 101268146 15841.502 POLYGON ((278014.2 310777.7...
#> 8         8    8  45966410 12188.988 POLYGON ((272184.4 308794.1...
#> 9         9    9  73993891 14217.903 POLYGON ((274931.9 307729.1...
#> 10       10   10  62915358 11239.120 POLYGON ((269582.8 308190.9...

aw_interpolate(ar_stl_wards, tid = WARD, source = ar_stl_asthma, sid = GEOID, weight = "sum",
    output = "tibble", intensive = "ASTHMA")
#> # A tibble: 28 × 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