R/cleanFileNames.R

Defines functions cleanFileNames

Documented in cleanFileNames

##' Drop spaces and odd characters. Use to ensure generated file names
##' are usable.
##' @param x a string to clean
##' @return A character vector
##' @keywords internal
## don't export - belongs in NMdata


cleanFileNames <- function(x,allow.slash=FALSE){


    x <- gsub("[ +!?#:;<>&,\\{\\}\\|=\\(\\)]", "",x) 
    if(!allow.slash){
        x <- gsub("/", "",x) 
    }
    x <- gsub(pattern="-",replacement="",x=x,perl=TRUE) 
    x <- gsub(pattern="\n",replacement="",x=x)
    
    x
}

Try the tracee package in your browser

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

tracee documentation built on Nov. 24, 2026, 5:07 p.m.