Skip to contents

This function adds healthcare need categories to individual-level data, including disability information if provided. It creates dummy variables for different healthcare need scenarios and optionally includes disability-specific indicators.

This function aggregates individual-level healthcare need data to the household level, including disability-specific information if provided.

Usage

add_loop_healthcare_needed_cat(
  loop,
  ind_healthcare_needed = "health_ind_healthcare_needed",
  ind_healthcare_needed_no = "no",
  ind_healthcare_needed_yes = "yes",
  ind_healthcare_needed_dnk = "dnk",
  ind_healthcare_needed_pnta = "pnta",
  ind_healthcare_received = "health_ind_healthcare_received",
  ind_healthcare_received_no = "no",
  ind_healthcare_received_yes = "yes",
  ind_healthcare_received_dnk = "dnk",
  ind_healthcare_received_pnta = "pnta",
  ind_age = "ind_age",
  ind_healthcare_type = "health_ind_healthcare_needed_type",
  ind_healthcare_type_lifesaving = c("consultation_acute", "consultation_chronic",
    "trauma", "emergency_surgery", "natal_services", "safe_delivery"),
  ind_healthcare_type_undefined = c("dnk", "pnta", "other"),
  sep = "/"
)

add_loop_healthcare_needed_cat_to_main(
  main,
  loop,
  ind_healthcare_needed_no = "health_ind_healthcare_needed_no",
  ind_healthcare_needed_yes_unmet = "health_ind_healthcare_needed_yes_unmet",
  ind_healthcare_needed_yes_met = "health_ind_healthcare_needed_yes_met",
  id_col_main = "uuid",
  id_col_loop = "uuid",
  ind_healthcare_needed_lifesaving_yes_unmet =
    "health_ind_healthcare_needed_lifesaving_yes_unmet"
)

Arguments

loop

A data frame of individual-level data.

ind_healthcare_needed

The name of the variable that indicates if healthcare is needed.

ind_healthcare_needed_no

The binary variable that indicates if healthcare is not needed.

ind_healthcare_needed_yes

Level for "yes" in ind_healthcare_needed.

ind_healthcare_needed_dnk

Level for "don't know" in ind_healthcare_needed.

ind_healthcare_needed_pnta

Level for "prefer not to answer" in ind_healthcare_needed.

ind_healthcare_received

The name of the variable that indicates if healthcare is received.

ind_healthcare_received_no

Level for "no" in ind_healthcare_received.

ind_healthcare_received_yes

Level for "yes" in ind_healthcare_received.

ind_healthcare_received_dnk

Level for "don't know" in ind_healthcare_received.

ind_healthcare_received_pnta

Level for "prefer not to answer" in ind_healthcare_received.

ind_age

The name of the variable that indicates the age of the individual.

ind_healthcare_type

The name of the variable that indicates the type of healthcare which was sought.

ind_healthcare_type_lifesaving

Character vector of levels in ind_healthcare_type that indicate life-saving healthcare.

ind_healthcare_type_undefined

Character vector of levels in ind_healthcare_type that are non-substantive (dnk, pnta, other); these yield NA for the life-saving flag.

sep

Separator for the binary columns.

main

A data frame of household-level data.

ind_healthcare_needed_yes_unmet

The binary variable that indicates if healthcare is needed but unmet.

ind_healthcare_needed_yes_met

The binary variable that indicates if healthcare is needed and met.

id_col_main

The column name for the unique identifier in the main data frame.

id_col_loop

The column name for the unique identifier in the loop data frame.

ind_healthcare_needed_lifesaving_yes_unmet

The binary variable that indicates if a life-saving healthcare is needed and unmet.

Value

A data frame with additional columns:

  • health_ind_healthcare_needed_d: Dummy variable for healthcare needed.

  • health_ind_healthcare_received_d: Dummy variable for healthcare received.

  • health_ind_healthcare_needed_cat: Categorized healthcare need: "no_need", "yes_unmet_need", or "yes_met_need".

  • health_ind_healthcare_needed_no: Dummy variable for no healthcare need.

  • health_ind_healthcare_needed_yes_unmet: Dummy variable for unmet healthcare need.

  • health_ind_healthcare_needed_yes_met: Dummy variable for met healthcare need.

  • health_ind_healthcare_needed_lifesaving_yes_unmet: Dummy variable for unmet lifesaving healthcare need (only when ind_healthcare_type column is present in loop).

A data frame with additional columns:

  • health_ind_healthcare_needed_no_n: Count of individuals not needing healthcare.

  • health_ind_healthcare_needed_yes_unmet_n: Count of individuals with unmet healthcare needs.

  • health_ind_healthcare_needed_yes_met_n: Count of individuals with met healthcare needs.

  • health_ind_healthcare_needed_lifesaving_yes_unmet_n: Count of individuals with unmet lifesaving healthcare needs (only when the column is present in loop).

  • health_ind_healthcare_needed_lifesaving_yes_unmet_at_least_one: Household binary for unmet lifesaving healthcare needs: 1 if any member has one, NA if no member is confirmed positive but at least one member's care type is unknown, and 0 if every member is a known negative (only when the column is present in loop).