12  Health profile (2)

Maps

12.0.1 Boundary file

A regional boundary file is downloaded as part of the data pre-processing step and is contained in the object sa_bound.

This can be plotted as a static or interactive map:

Code
ksa_bound |>
    ggplot() +
    geom_sf()

mapview(ksa_bound)
(a) static
(b) static
Figure 12.1: KSA boundary map

12.0.2 Plot data

Attribute data (e..g area rates) needs to be combined with the boundary data in order to map them. Taking the example of injury….

Code
inj <- read_csv("data/injury_dsr.csv")

12.0.4 Plot smoking rates as choropleth map

Code
## convert back to spatial data and plot
inj_sf |> st_as_sf() |>
    filter(!is.na(gender)) |>
    ggplot() +
    geom_sf(data = ksa_bound) +
    geom_sf(aes(fill = 100000 * adj.rate)) +
    ggplot2::geom_sf_label(aes(label = ADM1_EN)) +
    facet_wrap(~ gender, ncol = 1) +
    theme_void() +
    scale_fill_viridis_c(name = "DSR Injury\nper 100,000")

mapview(inj_sf |> st_as_sf() |>
    filter(gender == "female") |> mutate(adj.rate = 100000 * adj.rate), zcol = "adj.rate") 
(a) Static
(b) Static
Figure 12.2: Smoking rate map