interpolate a variable from one set of shapes to another

interpolateByArea(
  inputDf,
  inputShape,
  by,
  interpolateVar,
  outputShape,
  inputVars = inputDf %>% dplyr::groups(),
  outputVars = outputShape %>% dplyr::groups(),
  aggregateFn = sum
)

Arguments

inputDf

- in input data frame containing the variable(s) of interest to interpolate. Stratification of the variable can be achieved by grouping

inputShape

- an input sf map,

by

- the columns to use to join the inputDf to the map provided in inputShape. This is in the format of a dplyr join specification.

interpolateVar

- the column that we want to do areal interpolation on,

outputShape

- an output map which may be grouped by the desired output,

inputVars

- a list of columns from the inputDf (as a dplyr::vars(...) list) that define the stratification of inputDf and are desired in the output. Defaults to the grouping of inputDf

outputVars

- a list of columns from the outputShape (as a dplyr::vars(...) list) that we want preserved in output, or defined as a grouping of outputShape

aggregateFn

- a function that will be applied to area weighted components of interpolateVar - defaults to sum

Value

a dataframe containing the grouping columns, the outputIdVar and the interpolated value of interpolateVar