This function cleans up the code to update the flag variable based on exclusion criteria.
calculateGATflag(exclist, d)
The vector of settings to use, including variable names "var1", "var2", "var3", the criteria "math1", "math2", "math3", and the numeric values "val1", "val2", "val3".
The dataset containing the flag and exclusion variables.
exclist <- list(
var1 = "TOTAL_POP",
math1 = "less than",
val1 = 500,
var2 = "NONE", # if not "NONE", define math2 & val2
var3 = "NONE" # if not "NONE", define math3 & val3
)
calculateGATflag(exclist = exclist, d = hftown)
#> [1] 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 1 0 0 1 0