R/renameif.R

Defines functions renameif

Documented in renameif

#' renameif
#'
#' Renames a column if already exists otherwise doesn't do a thing
#'
#' @param x table
#' @param old string; old name
#' @param new string; new name@name
#'
#' @details
#'
#' Renames a column on the condition that it exists
#'
#' Does not take mu
#' Made with pipes in mind.
#'
#' @seealso 
#'  * [dplyr::rename()]
#'
#' @export

renameif <- function(x,old,new) {
  if( old %in% names(x) )
    setnames(x,old,new)
  invisible(x)
}
decisionpatterns/data.table.plus documentation built on June 15, 2020, 10:26 p.m.