
Add Water Expenditure Share of Income
Source:R/add_expenditure_water_share_income.R
add_expenditure_water_share_income.RdCalculates the share of frequent water expenditure relative to total household income and flags households spending 5% or more of income on water (catastrophic water spending).
This is a convenience wrapper around add_expenditure_type_share_income()
with fixed parameters for the water expenditure module: both expenditure and
income recall periods are 30 days, and the catastrophic threshold is 0.05
(5%).
Prerequisite: run add_expenditure_type_zero_freq() before calling this
function. cm_income_total must also be present in df, either directly
from the survey or via add_income_source_prop().
Usage
add_expenditure_water_share_income(
df,
expenditure_type = "cm_expenditure_frequent_water",
total_income = "cm_income_total"
)Value
A data frame with two additional columns:
cm_expenditure_frequent_water_share_income: Water expenditure share of income;1for zero-income households with water expenditure above0;NAif income or expenditure isNA.cm_expenditure_frequent_water_share_income_d:1Lif catastrophic (share >= 0.05),0Lif not (or for a zero-income household with zero water expenditure),NA_integer_if income or share isNA.
See also
Other expenditure_share_income:
add_expenditure_healthcare_share_income(),
add_expenditure_type_share_income()
Examples
df <- data.frame(
cm_expenditure_frequent_water = c(4, 5, 10),
cm_income_total = c(100, 100, 200)
)
add_expenditure_water_share_income(df)
#> cm_expenditure_frequent_water cm_income_total
#> 1 4 100
#> 2 5 100
#> 3 10 200
#> cm_expenditure_frequent_water_share_income
#> 1 0.04
#> 2 0.05
#> 3 0.05
#> cm_expenditure_frequent_water_share_income_d
#> 1 0
#> 2 1
#> 3 1