Skip to contents

Runs check_schema and turns the result into a hard stop, for use at the tail of a cleaning script (before write_rds) so a nonconforming study fails loudly where it is built. Any failing "error" check stops; any failing "warn" check emits a warning. Returns the report invisibly.

Usage

assert_schema(data, ..., study_id = NULL)

Arguments

data

A data frame or tibble.

...

Passed to check_schema.

study_id

Optional character scalar appended as a study_id column, so results stack across studies.

Value

The check_schema report tibble, invisibly.

See also

Examples

dat <- data.frame(resp_id = 1:3, weights = 1, Z = c(0, 1, 0), Y = c(0, 1, 1))
assert_schema(dat)