define_mpi_specs: Define MPI specifications: dimensions, indicators, and...

View source: R/define-mpi-specs.R

define_mpi_specsR Documentation

Define MPI specifications: dimensions, indicators, and weights

Description

Use to define MPI dimensions, indicators and its corresponding weights using any of the supported file types: .xlsx (Excel), .json, .csv, or .txt (TSV). You can also set the poverty cutoff or list of poverty cutoffs.

Usage

define_mpi_specs(
  mpi_specs_file = NULL,
  indicators = NULL,
  poverty_cutoffs = NULL,
  unit_of_analysis = NULL,
  uid = NULL,
  source_of_data = NULL,
  names_separator = getOption("mpindex.options")$names_separator %||% "__",
  save_as_global_options = FALSE,
  ...
)

Arguments

mpi_specs_file

Path to a .xlsx, .json, .csv, or .txt (TSV) file. The file must contain columns: Dimension, Indicator, Variable, Weight, and optionally Description.

indicators

A data frame of MPI indicators. Alternative to mpi_specs_file when you prefer to define indicators inline.

poverty_cutoffs

Single value or vector of poverty cutoffs (k). All values must be in (0, 1]. Default is NULL which will be automatically set to 1/n, where n is the total number of dimensions.

unit_of_analysis

e.g. "individuals", "households". Default NULL.

uid

Column name containing the unique ID (unit of analysis).

source_of_data

Source of data; used in output footnotes.

names_separator

[Deprecated] Column separator for the header hierarchy.

save_as_global_options

[Deprecated] No longer has any effect.

...

Reserved for forward-compatibility; passing old dotted argument names (e.g. .uid) triggers a helpful error.

Value

An mpi_specs object. Pass this directly as the mpi_specs argument in compute_mpi, define_deprivation, and save_mpi.

See Also

compute_mpi

Examples

specs_file <- system.file(
  "extdata",
  "global-mpi-specs.csv",
  package = "mpindex"
)
list.files(system.file("extdata", package = "mpindex"))


mpindex documentation built on Oct. 4, 2026, 5:07 p.m.