diff --git a/R/reverse.score.R b/R/reverse.score.R index 513f4b7f..5f6e2eca 100644 --- a/R/reverse.score.R +++ b/R/reverse.score.R @@ -5,7 +5,8 @@ #' #' @param data an object of class \code{data.frame}, \code{matrix}, or #' \code{table} with the response patterns -#' @param which names of items in \code{data} that should be rescored. If missing +#' @param which names of items or column integer location +#' in \code{data} that should be rescored. If missing #' the all columns in \code{data} will be reverse scored #' @param range (optional) a named \code{list} to specify the low and high #' score ranges. Specified names must match the names found in @@ -94,7 +95,7 @@ reverse.score <- function(data, which, range = NULL, append = ".RS"){ max[pick] <- max(range[[i]]) } } - subdat <- t((max - min) - t(subdat) + min) + subdat <- t(max - t(subdat) + min) data[,which] <- subdat nms <- colnames(data) nms[nms %in% which] <- paste0(nms[nms %in% which], append) diff --git a/man/reverse.score.Rd b/man/reverse.score.Rd index d9f1c087..c844b8aa 100644 --- a/man/reverse.score.Rd +++ b/man/reverse.score.Rd @@ -10,7 +10,8 @@ reverse.score(data, which, range = NULL, append = ".RS") \item{data}{an object of class \code{data.frame}, \code{matrix}, or \code{table} with the response patterns} -\item{which}{names of items in \code{data} that should be rescored. If missing +\item{which}{names of items or column integer location +in \code{data} that should be rescored. If missing the all columns in \code{data} will be reverse scored} \item{range}{(optional) a named \code{list} to specify the low and high