apply_weights: Internal function to apply the weights and perform some...

View source: R/aggregate.R

apply_weightsR Documentation

Internal function to apply the weights and perform some checks.

Description

Internal function to apply the weights and perform some checks.

Usage

apply_weights(
  data,
  mapping,
  weights,
  fewcol,
  manycol,
  valuecol,
  datacols,
  weightcol
)

Arguments

data

a data.table.

mapping

a mapping between the aggregated categories and their parts. *All* aggregated categories in 'data' have to be part of the mapping.

weights

table with weights for disaggregation, the name of the column with the aggregated categories has to be 'manycol'. If columns (other than the column with the aggregated category) of the 'weights' coincide with columns of the data, the respective columns are considered when joining.

fewcol

name of the column containing aggregated categories. Default is "region".

manycol

name of the column containing dis-aggregated categories. Default is "iso".

valuecol

name of the column with the actual value to disaggregate, default is 'value'.

datacols

index columns that label categories which have to be treated seperately when dis-aggregating with a weight.

weightcol

column with the weights for the dis-aggregation, default is 'weight'.


pik-piam/rmndt documentation built on April 21, 2024, 4:31 a.m.