#' Rescale level of agreement
#'
#' Rescale level of agreement from the four levels
#' \code{"Totally agree"}, \code{"Tend to agree"}, \code{"Tend to disagree"},
#' \code{"Totally disagree"}.
#' This is a wrapper function around the \code{\link{rescale_categories}} function.
#' @param column A column from a survey data with a four-level agreement scale.
#' @param from Defaults to \code{c("Totally agree", "Tend to agree",
#' "Tend to disagree", "Totally disagree")}.
#' @param to Defaults to \code{c(2,1,-1,2)} )
#' @param na_labels Defaults to \code{c("DK")}.
#' @param exact_from Deafults to \code{TRUE}. If \code{FALSE} you can use the
#' partial matching, but beware that in this case, \code{"twenty"} will be replaced by
#' @param return_class Default is \code{"numeric"}, alternatives \code{"character"} or
#' \code{"factor"}.
#' @examples
#' rescale_agreement_4 (c("Totally agree", "Tend to agree",
#' "Tend to disagree", "Totally disagree", "Missing"),
#' na_labels = "Missing")
#'
#' @export
rescale_agreement_4 <- function ( column,
from = c("Totally agree", "Tend to agree",
"Tend to disagree", "Totally disagree"),
to = c(2,1,-1,-2),
na_labels = c("DK"),
exact_from = TRUE,
return_class = "numeric") {
return(rescale_categories(column = column,
from = from, to = to,
na_labels = na_labels,
exact_from = exact_from,
return_class = return_class))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.