Skip to contents

Expands and merges cross-tabulated targets for weighting, using crosstab configs from settings. Use for multi-dimensional targets (e.g., age x gender).

Usage

prep_target_cross(target, crosstab_name, settings)

Arguments

target

data.table. Targets to expand and merge.

crosstab_name

character(1). Name of crosstab config in settings.

settings

list. Settings object with crosstab configs.

Value

data.table. Expanded cross-tabulated targets.

Details

  • Identifies columns for each crosstab target.

  • Melts, merges, and casts to wide format by crosstab dimensions.

  • Adds prefix to new columns and joins to original target table.

  • Returns data.table with expanded crosstab targets.

  • Assumes input is a data.table and settings are complete.

Settings

Uses crosstab configs in settings$targets.

Examples

## Not run:
prep_target_cross(target, 'age_gender', settings)
#> Error: object 'target' not found