rescore: Recoding Data

View source: R/rescore.r

rescoreR Documentation

Recoding Data

Description

Recodes or reverse codes a vector of scores

Usage

rescore(x, from, to = names(from), reverse = missing(from), trynumeric = TRUE)

Arguments

x

vector of scores to be recoded.

from

list of old values in x which will be recoded according to the name of the list element, unless to is specified.

to

vector of new values to be assigned to corresponding value(s) in from, assuming from and to are the same length.

reverse

logical, with default TRUE when from is missing. If TRUE, old and new are ignored and x is simply reverse coded. Assumes all possible values are at least ordinal scale quantitative and observed.

trynumeric

logical with default TRUE. If TRUE, an attempt is made to convert values in to to “numeric”. as.numeric(to) must first succeed without warnings.

Value

Returns a vector of recoded scores.


talbano/epmr documentation built on April 26, 2024, 6:34 a.m.