View source: R/weighted_gini.R
run_weighted_gini | R Documentation |
Compute Weighted Gini Index Across a List of Data Frames
run_weighted_gini(data_list, var_name, wgt_name = NULL, na.rm = TRUE)
data_list |
A named list of data frames, (e.g., across countries or years). |
var_name |
A string specifying the variable name (e.g., "dhi", "pilabour") to compute the Gini index on. |
wgt_name |
An optional string specifying the weight variable to be used. If |
na.rm |
Logical. If |
A named list. Each list element is named by country and contains a named numeric vector, where the names are years and the values are the computed statistics.
## Not run:
library(lissyrtools)
library(purrr)
datasets <- lissyrtools::lissyuse(data = c("de", "es", "uk"), vars = c("dhi"), from = 2016)
datasets %>%
map(~ .x %>% mutate(new_wgt = hwgt * nhhmem)) %>%
apply_iqr_top_bottom_coding("dhi", "hwgt") %>%
apply_sqrt_equivalisation("dhi") %>%
run_weighted_gini("dhi", "new_wgt")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.