R/rename_scale.R

Defines functions rename_scale

Documented in rename_scale

#' @title Rename Scale
#' @description Change the name of a npsych scale.
#' @param table PARAM_DESCRIPTION
#' @param scale PARAM_DESCRIPTION
#' @param name1 PARAM_DESCRIPTION
#' @param name2 PARAM_DESCRIPTION
#' @return OUTPUT_DESCRIPTION
#' @rdname rename_scale
#' @export
#' @importFrom dplyr mutate
#' @importFrom stringr str_replace
rename_scale <- function(table, scale, name1, name2) {
  table <-
    table %>%
    dplyr::mutate(scale = stringr::str_replace(
      string = scale,
      pattern = name1,
      replacement = name2
    ))
}
jtrampush/npsych.data documentation built on Feb. 25, 2025, 12:30 a.m.