Execute Zonal Stats
execute_zonal(
  data = NULL,
  geom = NULL,
  w = NULL,
  ID = NULL,
  fun = "mean",
  subds = 0,
  progress = FALSE,
  join = TRUE,
  drop = NULL,
  ...
)SpatRaster or file path
sf, sfc object with polygonal geometries
a weight grid (produced with weight_grid)
the grouping ID
an optional function or character vector, as described below
character or boolean to select a sub-dataset. If NULL all are selected
if TRUE, display a progress bar during processing
if TRUE the geom will be joined to the results
colnames to drop from table
optional arguments to pass fun
sf object or data.table