R/aggregate_zones.R
aggregate_zones.Rd
Aggregate data between zones Provides the ability to take attributes from one scale of polygon and split aggregate them to another.
aggregate_zones(
data,
geom,
crosswalk,
ID = "divide_id",
fun = "mean",
join = TRUE,
drop = NULL
)
tabular data reference to the smaller unit
sf, sfc, SpatialPolygonsDataFrame, or SpatialPolygons object with polygonal geometries
a crosswalk of smaller unit to major unit relations
the grouping ID
an optional function or character vector, as described below
if TRUE the geom will be joined to the results
colnames to drop from table
data.frame or sf object
the cross walk table must have at least 4 columns containing the ID and areas of the small units and
and the ID and areas of the large unit. The name of the large unit IDs is provided by the ID
parameter in the function
signature. The smaller unit IDs must have a corresponding attribute in the data input. The area of the larger units must be called
areasqkm
, while the area of the smaller units must be called s_areasqkm.