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

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.7 Index]