Skip to contents

Calculate income breaks (upper bounds) from income labels for HTS survey or ACS data. Use to bin or recode income variables for tabulation and reporting.

Usage

get_income_bounds(labels, direction = "upper", inf_rm = FALSE)

Arguments

labels

character vector. Income labels (e.g., from value_labels).

direction

character(1). Direction of break: "upper" (default), "lower", "mid".

inf_rm

logical. If TRUE, extrapolates last upper level to avoid Inf. Default FALSE.

Value

numeric vector. Income breaks for each label.

Details

  • Extracts upper, lower, or midpoint bounds from income labels.

  • Handles infinite values and extrapolates if requested.

  • Returns a numeric vector; does not modify by reference.

  • Assumes labels are character and contain numeric bounds; errors if not.

Settings

None.

See also

Examples

## Not run:
labels = value_labels[variable == 'income_broad', label]
#> Error: object 'value_labels' not found
get_income_bounds(labels)
#> Error in stri_trans_tolower(string, locale = locale): argument `str` should be a character vector (or an object coercible to)
## End(Not run)