powered by
Computes the longest run of identical consecutive item responses per respondent (the longstring index; cf. the CRAN package careless) and flags respondents whose run meets or exceeds max_run. The computation is vectorized over respondents.
max_run
detect_straightlining(x, items, max_run = 10L, id_var = NULL, severity = "warn", na_breaks_run = TRUE)
A dcc_findings table (check id Q_STRAIGHTLINING).
dcc_findings
Q_STRAIGHTLINING
A dcc_data object or data.frame.
dcc_data
Character vector of item column names, in presentation order.
Minimum run length considered straight-lining (default 10).
Name of the record-id column, or NULL for row numbers.
NULL
Severity assigned to findings (default "warn").
"warn"
Should a missing response break a run? (default TRUE).
TRUE
df <- data.frame(sid = c("S1", "S2"), q1 = c(1, 4), q2 = c(2, 4), q3 = c(1, 4), q4 = c(3, 4)) detect_straightlining(df, paste0("q", 1:4), max_run = 4, id_var = "sid")
Run the code above in your browser using DataLab