R/strip_year_suffix.R

Defines functions strip_year_suffix

Documented in strip_year_suffix

#' strip_year_suffix removes year suffixes from variable names
#'
#' @description Some structures in strayr contain variables with year
#' suffixes (e.g. \code{sa3_name_2011}). This function removes these year
#' suffixes from the dataset supplied.
#'
#' @param .data a dataframe
#'
#' @return a tibble
#'
#' @importFrom stringr str_remove
#'
#' @export
#'
strip_year_suffix <- function(.data) {
  names(.data) <- stringr::str_remove(names(.data), "\\_[0-9]{4}")
  return(.data)
}
runapp-aus/strayr documentation built on Oct. 15, 2024, 2:19 p.m.