View source: R/compute_functions.R
compute_poverty_rate | R Documentation |
experimental Computes the weighted poverty rate for a LIS or LWS variable.
compute_poverty_rate(
file,
file_name,
variable,
times_median,
weight = NULL,
na.rm = FALSE
)
file |
A LIS or LWS file. |
file_name |
The name of the LIS or LWS file. |
variable |
A character vector of length one with the indicator that needs to be transformed. |
times_median |
A number with the factor by which the median should be multiplied E.g. 0.5 for a poverty rate of 50% the median. |
weight |
A string with the name of the variable in 'file' that should be used as sample weights. |
na.rm |
A boolean indicating if the computation should ignore missing values in 'variable' and 'weight'. |
It uses 'pwgt' or 'hwgt' to weight the indicator.
A tibble with two columns: 'percentile' and 'value'. The first contains the label of the percentiles computed (e.g. '0.5' for median, '0.2' for first quintile). The second contains the values of these in the distribution of 'variable'.
## Not run:
lissy_datasets <- read_lissy_files(c("fr84h", "fr94h", "fr10h"))
compute_poverty_rate(lissy_datasets[["fr1984h"]], file_name = "fr84h", variable = "dhi", times_median = 0.5, na.rm = TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.