Skip to contents

Apply tax brackets to the data and impute new tax variable

Usage

match_tax_brackets(
  dta,
  base_var,
  rules,
  new_var,
  calc_drop = TRUE,
  low_thld_rule = `>`,
  up_thld_rule = `<=`
)

Arguments

dta

original data set to compute tax levels

base_var

string variable name that should be used used as income

rules

data frame with tax brackets rules returned with `make_tax_brackets`

new_var

string of the new variable to create based on the formula cum_tax + (base_var - lower) * rate

calc_drop

logical TRUE as default to compute the tax level and drop all auxiliary variables

low_thld_rule

rule for comparing income to the lower threshold. usually `>` (default) or `>`.

up_thld_rule

rule for comparing income to the upper threshold. usually `<=` (default) or `<`.