iprcalc.cen: ipr calculator based on census

iprcalc.cenR Documentation

ipr calculator based on census

Description

return ipr based user input of year, family size, # of children, and income

Usage

iprcalc.cen(year, familysize, children, income, result = c("ipr", "threshold"))

Arguments

year

year 2014 and up of for the poverty threshold to use from: https://www.census.gov/data/tables/time-series/demo/income-poverty/historical-poverty-thresholds.html

familysize

the total number of people in the household

children

the number of individuals under age of 18

income

the family income

result

enter result = "ipr" to return ipr value and result = "threshold" to return threshold. defaults ipr if unspecified.

#' @examples # if you have just single values iprcalc(2015, 5, 3, 30000) iprcalc(2015, 5, 3, 30000, result = "threshold")

Examples

# if you have a vector of values
iprcalc(year= c(2014, 2015, 2018),
        familysize = c(4, 5, 2),
       children = c(1, 3, 1),
        income = c(32000, 45000, 5000))

# if you have a dataframe with columns for the input and want to use with dplyr
# making fake data here
numofppl <- c(3, 2, 5, 3)
numofchildren <- c(1, 1, 2, 2)
totincome <- c(30000, 60000, 15000, 10000)
fake <- data.frame (numofppl, numofchildren, totincome)

library(dplyr)
fake %>%
  mutate (ipr = iprcalc(2019, numofppl, numofchildren, totincome),
          threshold = iprcalc(2019, numofppl, numofchildren, totincome,
                              result = "threshold")) -> fake
View (fake)



phoebehlam/fhrc documentation built on Nov. 10, 2023, 8:31 p.m.