check_constraint: check_constraint

Description Usage Arguments Details Value Examples

View source: R/prep_functions.R

Description

Checks a constraint table for common errors.

Usage

1
check_constraint(constraint_var, num_zones)

Arguments

constraint_var

The constraint table to check, usually a data frame

num_zones

The number of zones that should be present in the table

Details

Checks a constraint table for the following common errors:

Value

If no errors are detected the function returns silently. Any errors will stop the function or script to be investigated.

Examples

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

rakeR documentation built on May 2, 2019, 5:13 a.m.