Skip to contents

Builds weighted or unweighted quantile groups for an income variable. The default target is household per-capita income (ingtot_pc) and the default weight is fexp.

Usage

enemdu_build_quintiles(
  data,
  income_var = "ingtot_pc",
  weight = "fexp",
  quintile_var = "quintil_ingreso_pc",
  n = 5,
  use_weights = TRUE,
  overwrite = FALSE
)

Arguments

data

A data frame.

income_var

Income variable used to build quintiles.

weight

Weight variable. If absent and use_weights = TRUE, the function errors.

quintile_var

Output variable name.

n

Number of groups. Defaults to 5.

use_weights

Logical. If TRUE, builds weighted quantile cut points.

overwrite

Logical. If TRUE, overwrites an existing output variable.

Value

A data frame with the quintile variable added.