frev | R Documentation |
Provides a reversed version of the values from a factor, for instance a Likert type response scale.
frev(x, labels = FALSE)
x |
A factor |
labels |
Logical, invert the labels as well |
The argument labels
can also be used for the levels of a factor.
A factor of the same length as the original one.
Adrian Dusa
words <- c("ini", "mini", "miny", "moe")
variable <- factor(words, labels = words)
# inverts the values, preserving the labels' order
frev(variable)
# inverts both values and labels
frev(variable, labels = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.