Filters a census table by another area e.g. meshblocks by territorial area or region. It can only work if the geographic level is at a greater scale than the input data e.g. meshblocks < area_units < wards < local boards < territoral authorities < regions

filter_by_area(.data, geographic_level, geographic_filter, pattern)

Arguments

.data

The data set to be filtered. Must contain a column with census spatial names in it e.g. (Area_Code_and_Description).

geographic_level

The geographic level of the input spatial data e.g. area_units.

geographic_filter

The geographic level of the spatial filter e.g. region.

pattern

The pattern to match the area to filter by e.g. 'Wellington Region'.

Value

A sf dataframe.