Skip to contents

Aggregate targets to a higher-level geography by combining specified columns. Use within update_targets() to support aggregation logic.

Usage

aggregate_targets(updates_map, data, row_idx)

Arguments

updates_map

list. Mapping of new target names to old target column names.

data

data.table. Target data to update.

row_idx

logical vector. Indicates which rows to update.

Value

data.table with updated targets. Same schema as input, with aggregated columns.

Details

  • Iterates over mapping of new targets to old targets.

  • Sums values for each new target across specified old targets and rows.

  • Returns a copy; does not modify by reference.

  • Assumes valid mapping and input schema; errors if missing.

Settings

None.

Examples

## Not run:
aggregate_targets(updates_map, data, row_idx)
#> Error in aggregate_targets(updates_map, data, row_idx): could not find function "aggregate_targets"
## End(Not run)