
Binarize survey responses by cutpoints.
binarize_responses.RdConverts selected question columns to 0/1 based on scale or proportion cutpoints,
with optional NA recoding. Stores binarized_cols as an attribute.
Usage
binarize_responses(
data,
ques_cols = NULL,
ques_stem = NULL,
threshold = 0.5,
thresholds = list(),
na_values = NULL
)Arguments
- data
Data frame containing the items.
- ques_cols
Character vector of columns to binarize.
- ques_stem
Character vector of question stems to binarize.
- threshold
Proportion threshold for default binarization.
- thresholds
Named list of cutpoints by scale length.
- na_values
Values to recode to NA before binarization.