Skip to contents

Builds hsize by counting how many records share the same household identifier. This is required for household income construction and for the internal household-scale adjustment used in representativity diagnostics when household-level values are repeated across household members.

Usage

enemdu_build_hsize(
  data,
  household_id = "idhogar",
  hsize_name = "hsize",
  overwrite = FALSE
)

Arguments

data

A data frame.

household_id

Household identifier variable. Defaults to "idhogar". If "idhogar" is not present but "id_hogar" is present, the function uses "id_hogar" automatically.

hsize_name

Name of the output household-size variable. Defaults to "hsize".

overwrite

Logical. If TRUE, overwrites an existing hsize_name variable.

Value

A data frame with the household-size variable added.