View source: R/sim_annealing.R
add_constraint | R Documentation |
Add a new constraint to the mapping between a given macro dataset (class "macroACS") and a matching micro dataset (class "micro_synthetic). May be called repeatedly to create a set of constraints.
add_constraint( attr_name = "variable", attr_totals, micro_data, constraint_list = NULL )
attr_name |
The name of the attribute, or variable, that you wish to constrain. |
attr_totals |
A named integer vector of counts per level of the new constraining attribute. |
micro_data |
The micro dataset, of class |
constraint_list |
A |
A list of constraints.
## Not run: ## assumes that you have a micro_synthetic dataset named test_micro and attribute counts ## named a,e,g respectively c_list <- add_constraint(attr_name= "age", attr_totals= a, micro_data= test_micro) c_list <- add_constraint(attr_name= "edu_attain", attr_totals= e, micro_data= test_micro, constraint_list= c_list) c_list <- add_constraint(attr_name= "gender", attr_totals= g, micro_data= test_micro, constraint_list= c_list) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.