reverses reverse codes numeric data based on minimum and maximum
values. For example, say numerical values of response options can range from
1 to 4. The function will change 1 to 4, 2 to 3, 3 to 2, and 4 to 1. If there
are an odd number of response options, the middle in the sequence will be
unchanged.
Usage
reverses(data, vrb.nm, mini, maxi, suffix = "_r")
Value
data.frame of reverse coded variables with colnames specified by
paste0(vrb.nm, suffix).
Arguments
data
data.frame of data.
vrb.nm
character vector of colnames from data specifying the
variables.
mini
numeric vector of length 1 specifying the minimum numeric value.
maxi
numeric vector of length 1 specifying the maximum numeric value.
suffix
character vector of length 1 specifying the string to add to
the end of the colnames in the return object.
Details
reverses is simply a vectorized version of reverse to more
easily reverse code multiple columns of a data.frame at the same time.