aw_aggregate sums the new estimates produced by aw_calculate based on the target id. These are then joined with the target data. This is the fourth step in the interpolation process after aw_weight.

aw_aggregate(.data, target, tid, interVar, newVar)

Arguments

.data

A given intersected dataset

target

A sf object that data should be interpolated to

tid

A unique identification number within target

interVar

A variable containing an interpolated value created by aw_calculate

newVar

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

Value

A sf object with the interpolated value added to it.

Examples

library(dplyr)
#> #> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:stats’: #> #> filter, lag
#> The following objects are masked from ‘package:base’: #> #> intersect, setdiff, setequal, union
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") %>% aw_calculate(value = "TOTAL_E", areaWeight = "areaWeight") -> intersect aw_aggregate(intersect, target = wards, tid = WARD, interVar = TOTAL_E)
#> Simple feature collection with 28 features and 2 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: #> WARD TOTAL_E geometry #> 1 1 7991.565 POLYGON ((740184.2 4286431,... #> 2 2 12145.021 POLYGON ((742392.1 4289178,... #> 3 3 7344.287 POLYGON ((742956.1 4284113,... #> 4 4 8457.672 POLYGON ((739557.6 4284080,... #> 5 5 8783.377 POLYGON ((744883.8 4281632,... #> 6 6 14050.399 POLYGON ((742501.6 4279976,... #> 7 7 15840.086 POLYGON ((745618.6 4279867,... #> 8 8 12188.131 POLYGON ((739842.8 4277724,... #> 9 9 14217.149 POLYGON ((742619.4 4276734,... #> 10 10 11239.213 POLYGON ((737257.7 4277050,...