Apply a glue-template `pti_label` column to per-admin PTI tibbles
label_generic_pti.RdIterates over each admin-level tibble in `dta` and creates a `pti_label` column by interpolating `glue_expr` against the row's columns (typically `spatial_name`, `pti_name`, `pti_score`). Override `glue_expr` to customise hover popups in the leaflet map.
Usage
label_generic_pti(dta, glue_expr = generic_pti_glue())Value
A named list of the same shape as `dta`, each tibble with an added `pti_label` character column.
See also
Other pti-pipeline:
compile_pti_data(),
generic_pti_glue(),
run_pti_pipeline()
Examples
scores <- list(
admin1 = tibble::tibble(
spatial_name = c("Cherkasy", "Kyiv"),
pti_name = "Equal weights",
pti_score = c(0.42, -0.31)
)
)
labelled <- label_generic_pti(scores)
labelled$admin1$pti_label[1]
#> <strong>Cherkasy</strong><br/>Weighting scheme: <strong>Equal weights</strong><br/>PTI score: <strong>0.42000</strong><br/>
custom <- "{spatial_name}: {round(pti_score, 2)}"
label_generic_pti(scores, glue_expr = custom)$admin1$pti_label
#> Cherkasy: 0.42
#> Kyiv: -0.31