Clean grouped data to be used in PIP methods.
Details
If gd_type = 1
population
must be the cumulative proportion of
population and welfare
must be the cumulative proportion of income held by
that proportion of the population (Lorenz curve). If gd_type = 2
,
population
must be the proportion of population and welfare
must be the
proportion of income. If gd_type = 5
, then population
must be the
Percentage of the population in a given interval of incomes, whereas
welfare
must be the mean income of that interval.
Examples
# Load example data
data("gd_GHI_2009_income")
# Standardize dataset
wbpip:::gd_clean_data(
gd_GHI_2009_income, welfare = "welfare",
population = "weight", gd_type = 5)
#> ℹ columns "welfare" and "weight" have been rescaled to range (0,1]
#> country_code survey_year weight welfare area
#> <char> <num> <num> <num> <char>
#> 1: JKL 2009 0.1 0.02292242
#> 2: JKL 2009 0.2 0.05774930
#> 3: JKL 2009 0.3 0.10232770
#> 4: JKL 2009 0.4 0.15716421
#> 5: JKL 2009 0.5 0.22252476
#> 6: JKL 2009 0.6 0.29363491
#> 7: JKL 2009 0.7 0.38883260
#> 8: JKL 2009 0.8 0.50710468
#> 9: JKL 2009 0.9 0.66958790
#> 10: JKL 2009 1.0 1.00000000