irtc_check_data: Pre-Estimation Data Diagnostics

View source: R/irtc_check_data.R

irtc_check_dataR Documentation

Pre-Estimation Data Diagnostics

Description

Checks a response data set before model estimation and returns both a human-readable report and a machine-readable issue table, so that survey staff and automated callers (e.g. AI agents) can verify data quality and act on concrete fixes.

Checked, among others: number of items and persons, non-numeric (raw) response columns, negative or non-integer values, items without responses or without variance, extreme missingness, sparse categories, persons without any responses and duplicated person IDs.

Usage

irtc_check_data(x, key = NULL, verbose = TRUE)

## S3 method for class 'irtc_check'
print(x, lang = irtc_lang(), ...)

Arguments

x

An irtc_data object, a data frame or a matrix. For the print method: an irtc_check object.

key

If an answer key will be used for scoring, pass it here so that raw text columns are reported as scorable instead of as errors.

verbose

Logical: print the result?

lang

Output language, "zh" or "en".

...

Ignored.

Value

An object of class irtc_check: a list with ok (logical: no error-level issues), n_persons, n_items, n_errors, n_warnings and issues, a data frame with columns code, severity ("error", "warning", "info"), scope, where, message_en, message_zh, fix_en, fix_zh.

See Also

irtc_read, irtc

Examples

d <- data.frame(i1 = c(0, 1, 1, 0), i2 = c(1, 1, 1, 1),
    i3 = c(0, NA, 1, -9))
chk <- irtc_check_data(d, verbose = FALSE)
chk$ok
chk$issues[, c("code", "severity", "where")]
print(chk, lang = "en")

IRTC documentation built on July 24, 2026, 5:07 p.m.