likert (version 1.3.5)

reverse.levels: Reverse the levels of a factor.

Description

Reverse the levels of a factor.

Usage

reverse.levels(x)

Arguments

x
a factor or a data.frame of factors whose levels will be reverse coded.

Examples

Run this code
mylevels <- c('Strongly Disagree', 'Disagree', 'Neither', 'Agree', 'Strongly Agree')
test <- factor(sample(mylevels[1:5], 10, replace=TRUE))
cbind(test, as.integer(test), as.integer(reverse.levels(test)))

Run the code above in your browser using DataLab