R/invert.r

Defines functions invert

Documented in invert

#' Invert scales with any number of answer options
#' 
#' This function allows to easily invert items with any number of answer options. 
#' 
#' @param x The variable that should be inverted (needs to be numeric!).
#' @param length Number of answer options (defaults to )
#' @return A vector representing the recoded variable. 
#' @export
invert <- function(x, 
                   length = 5) {
  (x-(length+1))*-1
}
masurp/pmmisc documentation built on May 3, 2024, 7:13 p.m.