all_geogs_add_constraint function

Add new constraint to a set of geographies

Add new constraint to a set of geographies

Add a new constraint to the mapping between a a set of macro datasets and a matching set of micro dataset (supplied as class 'macro_micro'). May be called repeatedly to create a set of constraints across the sub-geographies.

all_geogs_add_constraint( attr_name = "variable", attr_total_list, macro_micro, constraint_list_list = NULL )

Arguments

  • attr_name: The name of the attribute, or variable, that you wish to constrain.
  • attr_total_list: A list of named integer vectors containing counts per level of the new constraining attribute for each geography.
  • macro_micro: The geographical dataset of macro and micro data. Should be of class "macro_micro".
  • constraint_list_list: A list of lists containing prior constraints on the same dataset for which you wish to add to. Defaults to NULL (ie. the default is that this is the first constraint.)

Returns

A list of constraint lists.

Examples

## Not run: # assumes that micro_synthetic already exists in your environment # 1. build constraints for gender and age g <- all_geog_constraint_gender(micro_synthetic, method= "macro.table") a <- all_geog_constraint_age(micro_synthetic, method= "macro.table") # 2. bind constraints to geographies and macro-data cll <- all_geogs_add_constraint(attr_name= "age", attr_total_list= a, macro_micro= micro_synthetic) cll <- all_geogs_add_constraint(attr_name= "gender", attr_total_list= g, macro_micro= micro_synthetic, constraint_list_list= cll) ## End(Not run)

See Also

add_constraint

  • Maintainer: Alex Whitworth
  • License: MIT + file LICENSE
  • Last published: 2022-10-26

Useful links