R/exportFct_ensureUniqueColumns.R

Defines functions exportFct_ensureUniqueColumns

exportFct_ensureUniqueColumns <- function(dat){
  # check whether any colnames are duplicated
  chkCols <- colnames(dat) %>% tolower
  isDupl <- duplicated(chkCols)
  if(any(isDupl)){
    newCols <- ifelse(isDupl, paste0(chkCols, "_2"), chkCols)
    colnames(dat) <- newCols
  }
  return(dat)
}

Try the TPP package in your browser

Any scripts or data that you put into this service are public.

TPP documentation built on Nov. 8, 2020, 5:55 p.m.