Compute the risk for each of the epidemiological units.

risk_unit(r, eu, fun = mean)

## Arguments

r RasterLayer object SpatialPolygons* object A summary function. By default the mean.

## Value

numeric vector of the same length as the number of epidemiological units.

## Details

Summarises the level of risk using a function such as the mean or median value across the epidemiological unit.

## Examples

  cmr <- mapMCDA_datasets()
cmr$cmr_admin3$rv <- risk_unit(cmr$animal.density, cmr$cmr_admin3)#> Warning: CRS object has comment, which is lost in output  sp::spplot(cmr\$cmr_admin3[, "rv"], cuts = 3)