getContainedIn: Generate a mapping representing how the input points fit into...

View source: R/arear.R

getContainedInR Documentation

Generate a mapping representing how the input points fit into the output shape

Description

This assumes an id column in input and output shapes and

Usage

getContainedIn(
  inputShape,
  outputShape,
  inputVars = inputShape %>% dplyr::groups(),
  outputVars = outputShape %>% dplyr::groups(),
  suffix = c(".x", ".y")
)

Arguments

inputShape

- a sf containing points of interest (or shapes)

outputShape

- a sf containing polygons to locate the input in

inputVars

- defines the columns of the input that you want to retain (as a dplyr::vars(...) list). This grouping should uniquely identify the row. If not present will use the current grouping of inputShape.

outputVars

- defines the columns of the output that you want to retain (as a dplyr::vars(...) list). This grouping should uniquely identify the row. If not present will use the current grouping of outputShape.

suffix

- the suffix of any duplicated columns as per dplyr::inner_join()

Value

- a mapping as a dataframe relating the input id column and output id columns

Examples

# find the hospitals in a given area.
mapping = getContainedIn(
inputShape = arear::surgecapacity,
outputShape = arear::ukcovidmap(),
inputVars = dplyr::vars(hospitalId),
outputVars = dplyr::vars(code)
)

terminological/arear documentation built on April 27, 2024, 9:02 a.m.