iprcalc.cen | R Documentation |
return ipr based user input of year, family size, # of children, and income
iprcalc.cen(year, familysize, children, income, result = c("ipr", "threshold"))
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") |
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.