Closed 03rcooke closed 3 years ago
Try this
min <- 1000
max <- 20000
by <- 1000
list_of_file_names <- apply(expand.grid(LETTERS,
as.character(seq(min, max, by = by)),
1:3),
1,
paste,
collapse="_")
list_of_file_names <- paste0(list_of_file_names, '.rdata')
findMinIteration <- function(list_of_file_names){
if(length(list_of_file_names) < 1) stop('list_of_file_names is empty')
if(!is.character(list_of_file_names)) stop('list_of_file_names must be a character')
# remove the last number and file extension
# find '_' followed by a signal number and a '.' and remove
# that and everything that follows
# remove '\\..+' if there is no file extension
list_of_file_names <- gsub('_[[:digit:]]{1}\\..+$', '', list_of_file_names)
# Extract the iterations number
iterations <- regmatches(list_of_file_names, regexpr('[[:digit:]]+$', list_of_file_names))
# Get minimum
return(min(as.numeric(iterations)))
}
findMinIteration(list_of_file_names)
I have currently bodged this code so that it works for the multiple different model structures. The problem is that the metadata from models that were daisy-chained is located in different positions for different taxonomic groups, e.g., for bwars models the metadata is located at _2000_1, but for bryophytes it's located at _4000_1
This is the code that needs fixing within
tempSampPost
: