Skip to contents

Checks a cohort against the domain invariants: controlled vocabularies for sex, injury_region, triage and therapy; life_points inside 1:6; unique non-missing id; and a positive whole arrival_order. All violations across all columns are collected and reported together.

Usage

validate_cohort(x, call = rlang::caller_env())

Arguments

x

A cohort from sdt_cohort().

call

The calling environment, used to attribute the error.

Value

x, invisibly, on success; otherwise an error of class sandtablR_error_cohort.

Examples

co <- sdt_cohort(sdt_synthetic_cohort(n = 5, seed = 1))
validate_cohort(co)