prorate: Adjust data to sum to control totals via prorate.row

prorateR Documentation

Adjust data to sum to control totals via prorate.row

Description

Prorating is for adjusting data to control totals in only 1 dimension. Use dbRake to adjust data in 2 dimensions.

Usage

prorate(data, control, VarRow, allowNegatives = FALSE)

Arguments

data

a dataframe to prorate (one row per VarRow)

control

a dataframe of control totals (one row per VarRow)

VarRow

a character, the name of the variable to prorate on (e.g., when prorating Sex for LHA to region control totals, VarRow = "Region")

allowNegatives

a logical of whether negative population values are allowed (usually FALSE)

Details

This function iteratively adjusts each row of data by running prorate.row which first prepares rows by running through calc.cols while the row's difference is not zero. For example, for 1:n_Sex, prorate so that region totals sum to region control totals. This is a helper function used in dbRake.

Value

original dataframe, that is now prorated by the adjustment values

Note

This function not currently integrated into dbRake

See Also

The overall raking function: dbRake()

Other raking helpers: add.random.fraction.to.cols(), adjustSex(), allowNegsnoMargin(), calc.cols(), multiRake(), noNegsneedMargin(), noNegsnoMargin(), prep.prorate.col(), prorate.col(), prorate.row(), read.inputs(), real.to.int(), rename.age.grps(), rounded()


bcgov/dbutils documentation built on Sept. 30, 2022, 12:04 a.m.