REDCap_attention_check: Evaluate a REDCap attention check column

View source: R/REDCap_attention_check.R

REDCap_attention_checkR Documentation

Evaluate a REDCap attention check column

Description

Replaces a column with a logical pass/fail value based on membership in condition, sets a label attribute, and moves the column to the end.

Usage

REDCap_attention_check(
  data,
  check.column,
  condition,
  label = "Attention check successful"
)

Arguments

data

A data frame.

check.column

Unquoted column to evaluate.

condition

Vector of accepted responses.

label

Label to attach to the resulting logical column.

Value

data with an updated attention check column.

Examples

dat <- data.frame(attention = c("A", "B", "A"))
REDCap_attention_check(dat, attention, condition = "A")

melidosData documentation built on April 22, 2026, 5:09 p.m.