pit: Calculate personal income tax liability in South Africa

View source: R/pit.R

pitR Documentation

Calculate personal income tax liability in South Africa

Description

Function to calculate personal income tax liability

Usage

pit(income, age, mtc, tax_year)

Arguments

income

a numeric vector of incomes

age

a numeric vector of ages, which is the age of each individual at the end of the tax year

mtc

a numeric vector of medical tax credits available in the tax year

tax_year

a numeric vector of the tax year for each record, where the number represents the year in which the tax year ends. For example, 2021 refers to the 2020/21 tax year.

Details

pit takes inputs of income (in Rands), age, medical tax credit and the tax year to calculate the tax liability in South Africa. Available for tax years 2010/11 to 2020/21.

Examples

# Calculate personal income tax
pit(income = 1000000, age = 53, mtc = 2550, tax_year = 2021)

# Same calculation in a relatively large dataframe with differing variables
individuals <- 1e6
df <- data.frame(Taxable_income = round(runif(individuals, 0, 3000000),0),
                 Age = round(runif(individuals, 18, 80),0),
                 MTC = round(runif(individuals, 0, 6000), 0),
                 Tax_year = round(runif(individuals, 2014, 2020), 0))

df$Simulated_tax <- pit(df$Taxable_income, df$Age, df$MTC, df$Tax_year)

# Or tidyverse way
library(dplyr)
df <- df %>%
  mutate(Simulated_tax = pit(Taxable_income, Age, MTC, Tax_year))

# Check pit_manual function for simulations with custom tax tables

chrisaxelson/tax4sa documentation built on July 17, 2025, 5:21 a.m.