recode: recodes item responses

Description Usage Arguments Details Value Author(s) Examples

View source: R/recode.R

Description

Recodes item responses as specified by original and modified

Usage

1
  recode(vec, original, modified)

Arguments

vec

a vector of item responses to be recoded

original

original item response categories, e.g., c(0,1,2,3)

modified

modified item response categories, e.g., c(1,2,3,4)

Details

vec, original, and modified must be of the same mode. original and modified must be of the same length.

Value

Returns a vector of the same length and mode as vec with recoded values.

Author(s)

Seung W. Choi <choi.phd@gmail.com>

Examples

1
2
3
4
5
x <- c(0,1,2,3,4,0,1,2,3,4)
y <- c(0,1,2,3,4)
z <- c(1,2,3,4,5)
recode(x,y,z)
##returns c(1,2,3,4,5,1,2,3,4,5)

lordif documentation built on May 2, 2019, 2:13 p.m.