Skip to content

Instantly share code, notes, and snippets.

@thmcmahon
Created June 6, 2017 03:49
Show Gist options
  • Save thmcmahon/a051c18ddde40e11136c3d89aaffd313 to your computer and use it in GitHub Desktop.
Save thmcmahon/a051c18ddde40e11136c3d89aaffd313 to your computer and use it in GitHub Desktop.
medicare_levy <- function(income, rate = .02, taper_threshold_lower = 21335, taper_threshold_upper = 26668) {
if (income < taper_threshold_lower) {
# People earning below the low income threshold pay no tax
return(0)
} else if (income >= taper_threshold_lower & income <= taper_threshold_upper) {
# People earning income that is between the taper thresholds pay 10 cents for each dollar over the low income threshold
return((income - taper_threshold_lower) * .1)
} else {
# People above the upper taper threshold pay the standard medicare levy
return(income * rate)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment