reverse.levels: Reverse the levels of a factor.

View source: R/reverse.levels.R

reverse.levelsR Documentation

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

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)))

jbryer/likert documentation built on June 13, 2025, 7:56 p.m.