Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • mapMCDA mapMCDA
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 31
    • Issues 31
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar

Maintenance - Mise à jour mensuelle Lundi 6 Février entre 7h00 et 9h00

  • UMR-ASTREUMR-ASTRE
  • mapMCDAmapMCDA
  • Issues
  • #50
Closed
Open
Issue created Sep 25, 2020 by Facundo Muñoz@famuvie®️Owner

Handle RasterBrick objects in risk_unit()

risk_unit(r, eu) computes the average risk at epidemiological unit taking a Raster as input and a vector map of epi-units. If r is a RasterBrick, risk_unit() currently uses the first layer. For uncertainty quantification, it would be useful to return a matrix instead of a vector, with as many columns as layers.

For type consistency, it would be better to return always a matrix, even in the case of single-column.

library(mapMCDA)
library(raster, quietly = TRUE)
packageVersion("mapMCDA")
#> [1] '0.4.52'

r <- raster(xmn=-110, xmx=-90, ymn=40, ymx=60, nrow = 10, ncol = 10)
r <- setValues(r, seq.int(ncell(r)))

## polygons covering the region by squares of 2x2 pixels
r0 <- r
res(r0) <- 2*res(r)
epiunits <- as(r0, "SpatialPolygons")

risk_unit(r, epiunits)
#>  [1]  6.5  8.5 10.5 12.5 14.5 26.5 28.5 30.5 32.5 34.5 46.5 48.5 50.5 52.5 54.5
#> [16] 66.5 68.5 70.5 72.5 74.5 86.5 88.5 90.5 92.5 94.5

risk_unit(brick(r, 2*r, 3*r), epiunits)
#>  [1]  6.5  8.5 10.5 12.5 14.5 26.5 28.5 30.5 32.5 34.5 46.5 48.5 50.5 52.5 54.5
#> [16] 66.5 68.5 70.5 72.5 74.5 86.5 88.5 90.5 92.5 94.5

Created on 2020-09-25 by the reprex package (v0.3.0)

Edited Sep 25, 2020 by Facundo Muñoz
Assignee
Assign to
Time tracking