Skip to contents

Creates the base table of risks where each risk associated with a study can be stored. Each risk is checked that its on the same scale.

Usage

risk_table(epi_units, scale = c(0, 100))

Arguments

epi_units

epidemiological units dataset

scale

the scale to use for all risk scores added to the risk table. Each new risk added to the table will be checked to ensure the same scale is used. For example, a risk table using a scale from 0 to 100 will not accept a risk on a scale from -1 to 1. This ensures comparability across risks.

Value

sf table with columns eu_id, eu_name and geometry, these all come directly from the epi_units argument.

See also

Other risk-table: add_risk(), remove_risk()

Examples

tunisia_raw <- sf::read_sf(system.file(
  package = "riskintrodata",
  "samples", "tunisia", "epi_units", "tunisia_adm2_raw.gpkg"
))

# Apply mapping to prepare colnames and validate dataset
tunisia <- apply_mapping(
  tunisia_raw,
  mapping = mapping_epi_units(
    eu_name = "NAME_2",
    geometry = "geom"
  ),
  validate = TRUE
)
#>  All data in "epi_units" valided.

rt <- risk_table(tunisia, scale = c(0, 100))
rt
#> Simple feature collection with 268 features and 2 fields
#> Geometry type: MULTIPOLYGON
#> Dimension:     XY
#> Bounding box:  xmin: 7.530076 ymin: 30.23681 xmax: 11.59826 ymax: 37.55986
#> Geodetic CRS:  WGS 84
#> # A tibble: 268 × 3
#>    eu_id    eu_name                                                     geometry
#>    <chr>    <chr>                                             <MULTIPOLYGON [°]>
#>  1 eu-00001 Ariana Médina      (((10.13861 36.89453, 10.14495 36.89476, 10.1512…
#>  2 eu-00002 Ettadhamen         (((10.05585 36.84308, 10.06575 36.85019, 10.0732…
#>  3 eu-00003 Kalaat El Andalous (((10.13862 36.89416, 10.1329 36.88994, 10.13283…
#>  4 eu-00004 Mnihla             (((10.1317 36.88428, 10.1317 36.88271, 10.1317 3…
#>  5 eu-00005 Raoued             (((10.16651 36.88694, 10.16422 36.88874, 10.1576…
#>  6 eu-00006 Sebkhet Ariana     (((10.27118 36.88874, 10.26842 36.88874, 10.2614…
#>  7 eu-00007 Sidi Thabet        (((10.01018 37.00285, 10.0102 37.00285, 10.01045…
#>  8 eu-00008 Soukra             (((10.19313 36.85656, 10.19313 36.85892, 10.1931…
#>  9 eu-00009 Amdoun             (((9.141866 36.86897, 9.140129 36.86767, 9.13747…
#> 10 eu-00010 Béja Nord          (((9.086732 36.70221, 9.082556 36.70772, 9.07813…
#> # ℹ 258 more rows