Create a table of target population parameters to be used for weighting data
Source:R/define_target_y2.R
define_target_y2.RdUse define_target_y2() to create a table of target population parameters to be used for weighting data. To avoid typos, define_target_y2() will automatically create an object in your R environment using the provided variable to create the name (e.g., "target_varname").
Arguments
- dataset
A dataframe with variables to be used in weighting.
- variable
The variable for which you will be supplying population parameters.
- target_params
A named vector containing target parameters you wish your data to be weighted to. If the variable has a "MISSING" level, you do not need to include it in the target_params, it will be calculated automatically (essentially set to weight those respondents as 1, the mean).