recode_items: recode_items

Description Usage Arguments Details Value Examples

View source: R/recode_items.R

Description

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

Usage

1
recode_items(items, original, recoded)

Arguments

items

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

This function is mostly used inside scoring algorithms. Input can be vectors, matrices, or dataframes.

Value

Recoded data are returned (usually questionnaire items).

Examples

1
2
3
4
5
6
## Not run: 

recode_items(1:4, 1:4, c("A", "B", "C", "D"))


## End(Not run)

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