powered by
Function to format filenames that can be used to unify the filenames style for more easily download or use
format_filenames(input_files = NULL, files_dir = NULL, pattern = ".*.txt", do.rename = FALSE, suffix = "", prefix = "", replace = list(old = c("-", "__"), new = c("_", "_")), toupper = FALSE, tolower = FALSE)
Basename of files that need to be format, default is NULL and use the regular expression pattern to select files
Directory name of input files
Use regular expression to select files in files_dir
If set TRUE, it will do rename step
Profix of filenames added in those without the same suffix
Prefix of filenames added in those without the same prefix
Use str_replace to replace all old to new separately
Filenames toupper, default is FALSE
Filenames tolower, default is FALSE
# NOT RUN { files_dir <- system.file('extdata', 'demo/format', package = 'ngstk') pattern <- '*.txt' x <- format_filenames(files_dir = files_dir, pattern = pattern, suffix = 'hg38_') # }
Run the code above in your browser using DataLab