clearify everything

This commit is contained in:
hollorol 2018-05-15 23:37:31 +02:00
parent 0cf2c1af66
commit 7164638d08
3 changed files with 31 additions and 15 deletions

View File

@ -45,7 +45,7 @@ getOutFiles <- function(outputLoc, outputNames){
return(grep("out$", grep(paste(paste0(outputNames, "*"), collapse = "|"), list.files(outputLoc), value=TRUE), value = TRUE)) return(grep("out$", grep(paste(paste0(outputNames, "*"), collapse = "|"), list.files(outputLoc), value=TRUE), value = TRUE))
} }
#' getOutFiles #' stampAndCopy
#' #'
#'This function gives us the muso output files with their paths #'This function gives us the muso output files with their paths
#' #'
@ -54,9 +54,22 @@ getOutFiles <- function(outputLoc, outputNames){
#'@return Output files with their paths #'@return Output files with their paths
#'@keywords internal #'@keywords internal
stampAndCopyDir <- function(outputLoc,names,stampDir, stampnum=NULL){ stampAndDir <- function(outputLoc,names,stampDir, wrongDir, type="output", errorsign){
if(!is.null(stampnum)){file.copy(file.path(outputLoc,names)
,file.path(stampDir,paste0((stampnum+1),"-",possibleNames))) switch(type,
} else{file.copy(file.path(outputLoc,names) "output" = (
,file.path(stampDir,paste0((stamp(stampDir)+1),"-",possibleNames)))} file.copy(file.path(outputLoc,names)
,file.path(stampDir,paste0((stamp(stampDir)+1),"-",names))) ),
"epc" = (function (){
stampnum <- stamp(stampDir)
lapply(names,function (x) file.copy(from = x ,to=paste(stampDir,"/",(stampnum+1),"-", basename(x),sep="")))
if(errorsign==1){
lapply(names, function (x) file.copy(from = paste(stampDir,"/",(stampnum+1),"-",basename(x),sep=""), to=wrongDir))}})(),
"log" = (
file.rename(names
,file.path(stampDir,paste0((stamp(stampDir)+1),"-",basename(names))))
)
)
} }

View File

@ -179,8 +179,7 @@ calibMuso <- function(settings,parameters=NULL, timee="d", debugging=FALSE, logf
if(keepBinary){ if(keepBinary){
possibleNames <- getOutFiles(outputLoc = outputLoc,outputNames = outputNames) possibleNames <- getOutFiles(outputLoc = outputLoc,outputNames = outputNames)
file.copy(file.path(outputLoc,possibleNames) stampAndDir(outputLoc = outputLoc,names = possibleNames,stampDir=binaryPlace,type="output")
,file.path(binaryPlace,paste0((stamp(binaryPlace)+1),"-",possibleNames)))
} }
} }
@ -219,12 +218,7 @@ calibMuso <- function(settings,parameters=NULL, timee="d", debugging=FALSE, logf
stop("Why are you playing with my nervs? Seriously? You hold your epc-s in different folders?") stop("Why are you playing with my nervs? Seriously? You hold your epc-s in different folders?")
} else { } else {
## epcfiles <- list.files(epcdir)[grep("epc$",list.files( stampAndDir(stampDir=EPCS,wrongDir=WRONGEPC,names=epc,type="epc",errorsig=errorsign)
stampnum<-stamp(EPCS)
lapply(epc,function (x) file.copy(from = x ,to=paste(EPCS,"/",(stampnum+1),"-", basename(x),sep="")))
if(errorsign==1){
lapply(epc, function (x) file.copy(from = paste(EPCS,"/",(stampnum+1),"-",basename(x),sep=""), to=WRONGEPC))
}
} }
} }

View File

@ -295,4 +295,13 @@ getyearlyout<-function(settings){
## } ## }
## } ## }
## file.copy(file.path(outputLoc,possibleNames)
## ,file.path(binaryPlace,paste0((stamp(binaryPlace)+1),"-",possibleNames)))
## epcfiles <- list.files(epcdir)[grep("epc$",list.files(
## stampnum<-stamp(EPCS)
## lapply(epc,function (x) file.copy(from = x ,to=paste(EPCS,"/",(stampnum+1),"-", basename(x),sep="")))
## if(errorsign==1){
## lapply(epc, function (x) file.copy(from = paste(EPCS,"/",(stampnum+1),"-",basename(x),sep=""), to=WRONGEPC))
## }