Skip to contents

Aggregates surprise values from smaller regions to larger regions, using spatial joins.

Usage

st_aggregate_surprise(x, to, fun = weighted.mean, weight_col = NULL)

Arguments

x

bs_surprise_sf object with surprise values

to

sf object defining larger regions to aggregate to

fun

Aggregation function (default: weighted.mean)

weight_col

Column name for weights (e.g., population)

Value

sf object with aggregated surprise values

Note

This function is experimental. Currently returns spatially joined data without full aggregation. For complex aggregations, use dplyr or data.table after retrieving the joined data.