R/col_renamer.R

Defines functions col_renamer

Documented in col_renamer

#' col_renamer
#'
#' Quickly add a word/phrase to all your column names
#' @param x Your data frame
#' @param term The word or phrase to add to the column names
#' @export

col_renamer <- function(x,term) {

  colnames(x) <- ifelse(str_detect(names(x),term)==FALSE,paste(term,names(x),sep='_'),names(x))

  return(x)

}
neugelb/neugelbtools documentation built on July 7, 2020, 1:17 a.m.