aw_aggregate | R Documentation |
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)
.data |
A given intersected dataset |
target |
A |
tid |
A unique identification number within |
interVar |
A variable containing an interpolated value created by |
newVar |
Optional; a new field name to store the interpolated value in. If not specified,
the |
A sf
object with the interpolated value added to it.
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") %>% aw_calculate(value = "TOTAL_E", areaWeight = "areaWeight") -> intersect aw_aggregate(intersect, target = wards, tid = WARD, interVar = TOTAL_E)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.