Reverse a Likert scale such that on a 0-10 scale, 10 becomes 0 and 0 becomes 10. Use the top and bottom arguments to specify the valid range of the scale.

likert_reverse(x, top, bottom)

Arguments

x

Numeric vector

top

Top value of the scale for the variable, e.g. 10 for a 0-10 scale.

bottom

value of the scale for the variable, e.g. 0 for a 0-10 scale.

Value

A numeric vector which is the "reverse" of the original likert scale variable.

Examples

data <-c(5, 4, 3, 2, 6)
likert_reverse(data, 6, 0)
#> [1] 1 2 3 4 0