all_geogs_add_constraint: Add new constraint to a set of geographies

Description Usage Arguments Value See Also Examples

View source: R/sim_anneal_wrappers.R

Description

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.

Usage

1
2
3
4
5
6
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.)

Value

A list of constraint lists.

See Also

add_constraint

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## 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)

synthACS documentation built on July 2, 2020, 2:29 a.m.