aw_calculate: Calculate Estimated Population

View source: R/aw_calculate.R

aw_calculateR Documentation

Calculate Estimated Population

Description

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

Usage

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


areal documentation built on May 31, 2022, 9:05 a.m.