Learn R Programming

DCC (version 1.2.1)

detect_missing_items: Detect excessive item nonresponse per respondent

Description

Flags respondents whose proportion of missing item responses exceeds max_prop. Like all detectors, it only finds; exclusion happens in the Execute stage.

Usage

detect_missing_items(x, items, max_prop = 0.5, id_var = NULL,
  severity = "warn", structural = NULL)

Value

A dcc_findings table (check id Q_MISSING_ITEMS, dimension completeness).

Arguments

x

A dcc_data object or data.frame.

items

Character vector of item column names.

max_prop

Maximum tolerated missing proportion (default 0.5).

id_var

Name of the record-id column, or NULL for row numbers.

severity

Severity assigned to findings (default "warn").

structural

Optional logical matrix (rows aligned to the data, columns to items) marking cells that were not administered -- e.g. from a skip_logic rule. Not-administered cells are excluded from both the numerator and denominator of the missing proportion. NULL (default) treats every item as administered and is byte-identical to the pre-1.1.0 behaviour.

Examples

Run this code
df <- data.frame(sid = c("S1", "S2"),
                 q1 = c(1, NA), q2 = c(2, NA), q3 = c(3, 1))
detect_missing_items(df, c("q1", "q2", "q3"), max_prop = 0.5,
                     id_var = "sid")

Run the code above in your browser using DataLab