gd_clean_data: Clean data (grouped)

View source: R/gd_clean_data.R

gd_clean_dataR Documentation

Clean data (grouped)

Description

Clean grouped data to be used in PIP methods.

Usage

gd_clean_data(dt, welfare, population, gd_type, quiet = FALSE)

Arguments

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.

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.

Value

data.table

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)


PIP-Technical-Team/wbpip documentation built on Nov. 29, 2024, 6:57 a.m.