aw_aggregate {areal} | R Documentation |
Aggregate Estimates Based on Target ID
Description
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.
Usage
aw_aggregate(.data, target, tid, interVar, newVar)
Arguments
.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 |
Value
A sf
object with the interpolated value added to it.
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") %>%
aw_calculate(value = "TOTAL_E", areaWeight = "areaWeight") -> intersect
aw_aggregate(intersect, target = wards, tid = WARD, interVar = TOTAL_E)
[Package areal version 0.1.8 Index]