aw_total produces a new total area field that contains the total area by source id. This is the second step in the interpolation process after aw_intersect.

aw_total(.data, source, id, areaVar, totalVar, type, weight)

Arguments

.data

A sf object that has been intersected using aw_intersect

source

A sf object with data to be interpolated

id

A unique identification number

areaVar

The name of the variable measuring a feature's area, which is created as part of aw_intersect

totalVar

The name of a new total area field to be calculated

type

One of "intensive" or "extensive"

weight

One of "sum" or "total"

Value

A sf object with the intersected data and new total area field.

Examples

library(dplyr) race <- select(ar_stl_race, GEOID, TOTAL_E) wards <- select(ar_stl_wards, WARD) wards %>% aw_intersect(source = race, areaVar = "area") -> intersect aw_total(intersect, source = race, id = GEOID, areaVar = "area", totalVar = "totalArea", weight = "sum", type = "extensive")
#> Simple feature collection with 287 features and 5 fields #> geometry type: GEOMETRY #> dimension: XY #> bbox: xmin: 733361.8 ymin: 4268411 xmax: 746155.7 ymax: 4295504 #> projected CRS: NAD83 / UTM zone 15N #> First 10 features: #> GEOID TOTAL_E WARD area totalArea #> 1 29510106500 2863 1 4.271176e+05 1064776.2 #> 2 29510106700 3168 1 5.946820e+05 1239241.5 #> 3 29510107500 1991 1 6.146361e+05 912325.0 #> 4 29510107600 1958 1 1.071347e+06 1146634.4 #> 5 29510110100 2820 1 5.563665e+01 994606.5 #> 6 29510109600 3050 1 3.586828e+03 3157835.4 #> 7 29510126900 4462 1 8.903340e+05 4334701.5 #> 8 29510127000 1826 1 1.015451e+03 14726832.5 #> 9 29510106400 1986 1 6.866924e+05 1107191.4 #> 10 29510108100 3309 1 1.198667e+02 3216478.2 #> geometry #> 1 POLYGON ((738110.9 4283989,... #> 2 POLYGON ((738335.2 4283055,... #> 3 POLYGON ((740111.6 4286547,... #> 4 POLYGON ((739386.1 4285082,... #> 5 POLYGON ((739542.5 4283728,... #> 6 POLYGON ((740899.6 4285240,... #> 7 POLYGON ((739115.9 4285807,... #> 8 MULTIPOLYGON (((740936.1 42... #> 9 POLYGON ((738500.9 4284750,... #> 10 POLYGON ((740163.9 4286467,...