risk_unit.Rd
Compute the risk for each of the epidemiological units.
risk_unit(r, eu, fun = mean)
SpatRaster object
sf or sfc object of type POLYGON
A summary function. By default the mean.
numeric vector of the same length as the number of epidemiological units.
Summarises the level of risk using a function such as the mean or median value across the epidemiological unit.
cmr <- mapMCDA_datasets()
cmr$cmr_admin3$rv <- risk_unit(r = cmr$animal.density, eu = cmr$cmr_admin3)
plot(cmr$cmr_admin3["rv"], pal = hcl.colors, nbreaks = 4, breaks = "quantile")