get_bins: Bins

View source: R/get_bins.R

get_binsR Documentation

Bins

Description

Calculate bins. TO BE DOCUMENTED.

Usage

get_bins(
  .data,
  welfare,
  weight,
  distribution_type = c("micro", "group", "aggregate", "imputed"),
  nbins = 100,
  output = "simple"
)

Arguments

.data

Household survey data frame with at least a welfare variable.

welfare

numeric: A vector of income or consumption values.

weight

numeric: A vector of weights.

distribution_type

character: Type of distribution, either micro, group, aggregate or imputed.

nbins

numeric: Number of bins.

output

character: It has two varieties. 1) it could be a vector of variables to retain after calculations (variables available are "welfare", "weight", "cum_pop", "cum_prop_pop", and "bins"). 2) It could be a one of two key words, "simple" or "full". output = "simple" is equivalent to output = "bins" (which is the default). output = "full" if equivalent to a vector with all the variables available, output = c("welfare", "weight", "cum_pop", "cum_prop_pop","bins")

Value

data.frame

Examples

data("md_ABC_2000_income")
df <- md_ABC_2000_income

bins <- get_bins(df, welfare, weight)
str(bins)

bins <- get_bins(df, welfare, weight, output = "full")
str(bins)

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