define_deprivation: Define deprivation cutoffs

View source: R/define-deprivation.R

define_deprivationR Documentation

Define deprivation cutoffs

Description

Sets a deprivation cutoff for a single indicator. For each unit of analysis, the result is 0 (not deprived), 1 (deprived), or NA (missing). An additional weighted column (indicator value × weight) is also computed.

Usage

define_deprivation(
  .data,
  indicator,
  cutoff,
  mpi_specs = NULL,
  collapse_fn = NULL,
  set_na_equal_to = 0,
  ...
)

Arguments

.data

A data frame or tibble.

indicator

Name of the indicator as defined in the MPI Specs (must exactly match the variable column).

cutoff

A logical expression that evaluates to TRUE for deprived units.

mpi_specs

MPI specifications from define_mpi_specs.

collapse_fn

An optional function to collapse roster-level data to the unit-of-analysis level (e.g. max). NULL (default) means no collapsing.

set_na_equal_to

Coerce NA values to 0 (not deprived, default) or 1 (deprived).

...

Reserved; passing old dotted names triggers a helpful error.

Value

A data frame with columns *_unweighted and *_weighted.

See Also

define_mpi_specs

Examples

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

specs <- define_mpi_specs(specs_file, uid = "uuid")

define_deprivation(
  df_household,
  indicator = drinking_water,
  cutoff = drinking_water == 2,
  mpi_specs = specs
)

define_deprivation(
  df_household_roster,
  indicator = school_attendance,
  cutoff = attending_school == 2,
  mpi_specs = specs,
  collapse_fn = max
)


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