R/nm_map.R

#' Map names using function
#'
#' #' Data.frame of old => new names
#' @export

nm_map <- function (data, fun)
{
  nms.old <- data %>% copy() %>% names()
  nms.new <- data %>% copy() %>% conform(fun) %>% names
  ret <- data.frame(old = nms.old, new = nms.new)
  if (is.data.table(data))
    setDT(ret)
  ret
}
decisionpatterns/nameit documentation built on Aug. 22, 2020, 4:18 a.m.