aw_calculate multiplies the given value by the area weight. This is the fourth step in the interpolation process after aw_weight.

aw_calculate(.data, value, areaWeight, newVar)

Arguments

.data

A given intersected dataset

value

A column within source to be interpolated

areaWeight

The name of the variable containing area weight per feature

newVar

Optional; a new field name to store the interpolated value in. If not specified, the value argument will be used as the new field name.

Value

An intersected file of class sf with a new field of interest recalculated with area weight

Examples

library(dplyr)

race <- select(ar_stl_race, GEOID, TOTAL_E)
wards <- select(ar_stl_wards, WARD)

wards %>%
    aw_intersect(source = race, areaVar = "area") %>%
    aw_total(source = race, id = GEOID, areaVar = "area", totalVar = "totalArea",
             weight = "sum", type = "extensive") %>%
    aw_weight(areaVar = "area", totalVar = "totalArea", areaWeight = "areaWeight") -> intersect

aw_calculate(intersect, value = "TOTAL_E", areaWeight = "areaWeight")
#> Simple feature collection with 286 features and 6 fields
#> Geometry type: GEOMETRY
#> Dimension:     XY
#> Bounding box:  xmin: 265638 ymin: 299509.9 xmax: 278973 ymax: 326430.3
#> Projected CRS: NAD_1983_HARN_StatePlane_Missouri_East_FIPS_2401
#> First 10 features:
#>          GEOID      TOTAL_E WARD         area  totalArea
#> 1  29510106500 1.148421e+03    1 4.268099e+05  1064032.5
#> 2  29510106700 1.520247e+03    1 5.942485e+05  1238338.0
#> 3  29510107500 1.341296e+03    1 6.141786e+05   911677.5
#> 4  29510107600 1.800575e+03    1 1.074142e+06  1168054.2
#> 5  29510110100 1.577594e-01    1 5.559584e+01   993793.8
#> 6  29510126900 9.164090e+02    1 8.896824e+05  4331867.8
#> 7  29510127000 1.260681e-01    1 1.014709e+03 14697280.1
#> 8  29510108100 1.239119e-01    1 1.197780e+02  3198604.2
#> 9  29510106400 1.231736e+03    1 6.861954e+05  1106392.9
#> 10 29510107500 3.382533e-02    2 1.548859e+01   911677.5
#>                          geometry   areaWeight
#> 1  POLYGON ((270624.5 315101.4... 4.011249e-01
#> 2  POLYGON ((270823.1 314161.8... 4.798758e-01
#> 3  POLYGON ((272693.4 317603.1... 6.736797e-01
#> 4  POLYGON ((271928.5 316159, ... 9.195993e-01
#> 5  POLYGON ((272047.9 314802.1... 5.594303e-05
#> 6  POLYGON ((271678.3 316891, ... 2.053808e-01
#> 7  MULTIPOLYGON (((273486.1 31... 6.904061e-05
#> 8  POLYGON ((272743.5 317521.7... 3.744694e-05
#> 9  POLYGON ((271034.9 315851.6... 6.202095e-01
#> 10 POLYGON ((272862.1 317334.3... 1.698911e-05