Description Usage Arguments Details Value Examples
View source: R/prep_functions.R
Checks a constraint table for common errors.
1 | check_constraint(constraint_var, num_zones)
|
constraint_var |
The constraint table to check, usually a data frame |
num_zones |
The number of zones that should be present in the table |
Checks a constraint table for the following common errors:
Ensures all zone codes are unique
Ensures there are the expected number of zones
Ensures all but the zone column are numeric (integer or double)
If no errors are detected the function returns silently. Any errors will stop the function or script to be investigated.
1 2 3 4 5 6 7 8 | cons <- data.frame(
"zone" = letters[1:3],
"age_0_49" = c(8, 2, 7),
"age_gt_50" = c(4, 8, 4),
"sex_f" = c(6, 6, 8),
"sex_m" = c(6, 4, 3)
)
check_constraint(cons, 3) # no errors
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.