check_constraint {rakeR}R Documentation

check_constraint

Description

Checks a constraint table for common errors.

Usage

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

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

[Package rakeR version 0.2.1 Index]