Skip to contents

Rewrites one administrative sheet in a metadata workbook by validating supplied value columns against the workbook metadata and joining those values to the existing administrative rows by P-code.

Usage

pti_patch_admin_sheet(
  mtdt_path = "sample-data/metadata-skeleton.xlsx",
  admin_level = "admin2_District",
  values,
  pcod_col,
  output_path = "app-data/metadata-user.xlsx"
)

Arguments

mtdt_path

Character. Path to the source metadata `.xlsx` workbook.

admin_level

Character. Name of the administrative sheet to patch.

values

A data frame or tibble containing the P-code column and one or more indicator columns whose names match `metadata$var_code`.

pcod_col

Character. Name of the P-code join column in `values`.

output_path

Character. Path where the patched metadata `.xlsx` workbook should be written.

Value

Invisibly returns `output_path`.

Examples

if (FALSE) { # \dontrun{
pti_patch_admin_sheet(
  mtdt_path = "sample-data/metadata-skeleton.xlsx",
  admin_level = "admin2_District",
  values = adm2_values,
  pcod_col = "admin2Pcod",
  output_path = "app-data/metadata-user.xlsx"
)
} # }