View source: R/gd_clean_data.R
gd_clean_data | R Documentation |
Clean grouped data to be used in PIP methods.
gd_clean_data(dt, welfare, population, gd_type, quiet = FALSE)
dt |
data.frame: A table with survey data. |
welfare |
character: Name of welfare column. |
population |
character: Name of population column. |
gd_type |
numeric: Type of data. See details. |
quiet |
logical: If TRUE output messages are suppressed. |
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.
data.table
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.