recode_items_in_matrix: recode_items_in_matrix

Description Usage Arguments Details Value Examples

View source: R/jamie-internals.R

Description

This function is used to recode items within a matrix (e.g., 1 = 4, 2 = 3, 3 = 2, 4 = 1).

Usage

1
recode_items_in_matrix(items_matrix, original, recoded)

Arguments

items_matrix

A matrix containing items to be recoded.

original

A vector containing the original coding of the variable (e.g., 1, 2, 3, 4).

recoded

A vector containing the recoding of the variable (e.g., 4, 3, 2, 1). "recoded" and "original" must be the same length.

Details

The input must be a matrix or an error will result.

Value

A matrix of recoded data are returned (usually questionnaire items).

Examples

1
2
3
4
## Not run: 
score_items_in_matrix(as.matrix(a_dataframe[some_items]))

## End(Not run)

jameswgriffith/jamie documentation built on Dec. 20, 2021, 9:03 p.m.