recode_items_in_df: recode_items_in_df

Description Usage Arguments Details Value Examples

View source: R/jamie-internals.R

Description

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

Usage

1
recode_items_in_df(items_df, original, recoded)

Arguments

items_df

A dataframe 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 dataframe or an error will result.

Value

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

Examples

1
2
3
4
## Not run: 
score_items_in_df(a_dataframe[some_items])

## End(Not run)

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