define_mpi_specs {mpindex}R Documentation

Define MPI specifications: dimensions, indicators, and weights

Description

Use to define MPI dimensions, indicators and its corresponding weights using any of the accessible file types: .xlsx (Excel), .json, .csv, or .txt (TSV). You can also set the poverty cutoff or list of poverty cutoffs (to achieve gradient list of MPIs) that will be used in the computation of MPI.

Usage

define_mpi_specs(
  .mpi_specs_file = NULL,
  .indicators = NULL,
  .poverty_cutoffs = 1/3,
  .unit_of_analysis = NULL,
  .aggregation = NULL,
  .uid = NULL,
  .source_of_data = NULL,
  .names_separator = ">",
  .save_as_global_options = TRUE
)

Arguments

.mpi_specs_file

Accepts .xlsx (Excel), .json, .csv, or .txt (TSV) file format. This file should contain the following columns/variables: Dimension, Indicator, Variable, Weight, and Description (optional). See example below.

.indicators

A data frame of MPI indicators. Useful if prefer define your indicators instead of using an external file.

.poverty_cutoffs

Accepts single value or a vector of poverty cutoffs. This parameter (usually denoted by k) reflects the minimum level of deprivations or deprivation score an individual or household must be suffering simultaneously to be considered poor. See example below.

.unit_of_analysis

e.g. individuals, families, households, or communities. Default value is NULL.

.aggregation

Column name in the dataset that defines an aggregation level.

.uid

Column name containing unique ID of the dataset which defines the lowest level of disaggregation (usually unit of analysis).

.source_of_data

Source of data used in the computation. This will be used in the footnote of the table when generating an output.

.names_separator

[Deprecated] Column separator that defines the hierarchy of the column header.

.save_as_global_options

Whether to save the specs globally. Equivalent to invoking options().

Value

MPI specifications data frame required in compute_mpi function. As as side effect, a global option named ‘mpi_specs' will be saved for efficiency. See 'getOption(’mpi_specs')'.

See Also

compute_mpi

Examples

# Use sample specs file included in the package
specs_file <- system.file(
  "extdata",
  "global-mpi-specs.csv",
  package = "mpindex"
)
# To see other sample specs file (with different supported file format)
system.file("extdata", package = "mpindex") |>
  list.files()


[Package mpindex version 0.2.1 Index]