Skip to contents

Create a table for MSNA Indicator Maps 1.2 tool

Usage

create_table_for_map(
  results_table,
  group_var_value_column = "group_var_value",
  analysis_var_column = "analysis_var",
  stat_column = "stat",
  number_classes = 5
)

Arguments

results_table

Results table from analysistools filtered for only value per admin.

group_var_value_column

Name of the column with the group/dependent variable values. Default is "group_var_value".

analysis_var_column

Name of the column with the analysis/independent variable names. Default is "analysis_var".

stat_column

Name of the column with the stat. Default is "stat".

number_classes

Number of classes for the map. It will convert percentages to classes. Default value is 5.

Value

A wide table with group variables in rows and the indicators coded in their classes in the columns.

Details

There can be 5 or 6 classes as follow:

5 classes:

  • 1 : 0

  • 2 : <= 25 %

  • 3 : <= 50 %

  • 4 : <= 75 %

  • 5 : <= 100 %

  • NA: Anything else

6 classes:

  • 1 : 0

  • 2 : <= 20 %

  • 3 : <= 40 %

  • 4 : <= 60 %

  • 5 : <= 80 %

  • 6 : <= 100 %

  • NA: Anything else

Examples

presentresults::presentresults_MSNA2024_results_table |>
  dplyr::filter(
    analysis_var == "wash_drinking_water_source_cat",
    analysis_var_value == "surface_water",
    group_var == "admin1"
  ) |>
  create_table_for_map()
#> # A tibble: 2 × 2
#>   group_var_value wash_drinking_water_source_cat
#>   <chr>           <chr>                         
#> 1 PCODE1          2                             
#> 2 PCODE2          2