st_intersect_summarize: Function to perform areal interpolation of variables

Description Usage Arguments Details Value

View source: R/st_intersect_summarize.R

Description

st_intersect_summarize performs areal interpolation of variables from one geometry to another.

Usage

1
2
3
4
5
6
7
8
st_intersect_summarize(
  data,
  destination,
  population,
  group_vars = NULL,
  count_vars = NULL,
  mean_vars = NULL
)

Arguments

data

An sf data frame with polygon geometries, containing the fields to be aggregated and reapportioned.

destination

An sf data frame with polygon geometries which the data should be reapportioned to.

population

The name of a field in the 'data' table which sets the weighting for other variables.

group_vars

The name of a field in the 'destination' table to be used to reassemble the data. This will generally be a unique identifier (e.g. a GeoUID) of the polygons in the 'destination' table. If NULL (default), TKTK

count_vars

A list of field names which are present in the 'data' table and which represent per-polygon counts which can be meaningfully aggregated through addition. (An example is the number of residents who commute to work by car.) The variable list must be supplied inside of 'vars()'.

mean_vars

A list of field names which are present in the 'data' table and which represent per-polygon averages which cannot be meaningfully aggregated through addition. (An example is the percentage of residents who commute to work by car.) The variable list must be supplied inside of 'vars()'.

Details

A function for translating variables from one polygon geometry to another, using constant areal interpolation. The function works with variables which represent counts within a polygon ('count_vars') and with variables which represent averages across a polygon ('mean_vars'). Using an additional variable representing the population (or other weighting factor) of each polygon ('population'), the function reapportions the variables from the origin geometry (in 'data') to the destination geometry ('destination'), using an optional 'group_vars' argument to control how the destination geometry is assembled. It works by assuming that variables are evenly distributed throughout the polygons.

The output will be projected in the same CRS as the 'destination' table.

Value

The function returns a table with the variables of interest reassembled in the 'destination' geometry (potentially modified by 'group_vars').


UPGo-McGill/upgo documentation built on Nov. 20, 2021, 2:26 a.m.