Skip to content

Commit

Permalink
fnAppend support for multiple paths
Browse files Browse the repository at this point in the history
  • Loading branch information
philipdelff committed Dec 31, 2023
1 parent ce1abc2 commit aecc366
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion R/fnAppend.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ fnAppend <- function(fn,x,pad0=0,sep="_"){
has.ext <- grepl(".*[^\\.]\\.[a-zA-Z0-9]+",fn)
if(!all(has.ext)) stop("No file name extension found. Cannot append string.")
fnext <- sub(".*[^\\.]\\.([a-zA-Z0-9]+)$","\\1",fn)
fnroot <- sub(paste0("\\.",fnext,"$"),"",fn)
## fnroot <- sub(paste0("\\.",fnext,"$"),"",fn)
fnroot <- sub(paste0("\\.[a-zA-Z0-9]+$"),"",fn)

if(is.numeric(x)){
string <- sprintf(fmt=paste("%0",pad0,"d",sep=""),x)
Expand Down

0 comments on commit aecc366

Please sign in to comment.