risk_unit.RdCompute the risk for each of the epidemiological units.
risk_unit(r, eu, fun = mean)
| r | RasterLayer object |
|---|---|
| eu | SpatialPolygons* object |
| fun | 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(cmr$animal.density, cmr$cmr_admin3) sp::spplot(cmr$cmr_admin3[, "rv"], cuts = 3)