aggregate_zones: Aggregate data between zones Provides the ability to take...

View source: R/aggregate_zones.R

aggregate_zonesR Documentation

Aggregate data between zones Provides the ability to take attributes from one scale of polygon and split aggregate them to another.

Description

Aggregate data between zones Provides the ability to take attributes from one scale of polygon and split aggregate them to another.

Usage

aggregate_zones(
  data,
  geom,
  crosswalk,
  ID = "divide_id",
  fun = "mean",
  join = TRUE,
  drop = NULL
)

Arguments

data

tabular data reference to the smaller unit

geom

sf, sfc, SpatialPolygonsDataFrame, or SpatialPolygons object with polygonal geometries

crosswalk

a crosswalk of smaller unit to major unit relations

ID

the grouping ID

fun

an optional function or character vector, as described below

join

if TRUE the geom will be joined to the results

drop

colnames to drop from table

Details

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.

Value

data.frame or sf object


mikejohnson51/zonal documentation built on Dec. 9, 2024, 11:52 p.m.