Skip to content

Commit

Permalink
closes #52
Browse files Browse the repository at this point in the history
  • Loading branch information
philchalmers committed Dec 10, 2024
1 parent 1182782 commit 761aeda
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
11 changes: 9 additions & 2 deletions R/SimCollect.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
#' \code{SimExtract(what='results')} information. This is mainly useful when RAM is an issue
#' given simulations with many stored estimates. Default includes the results objects
#' in their entirety, though to omit all internally stored simulation results pass the
#' character \code{'NONE'}
#' character \code{'NONE'}. To investigate the stored warnings and error messages in isolation
#' pass \code{'WARNINGS'} or \code{'ERRORS'}, respectively
#'
#' @param check.only logical; for larger simulations file sets, such as those generated by
#' \code{\link{runArraySimulation}}, return the design conditions that do no satisfy the
Expand Down Expand Up @@ -145,6 +146,9 @@
#' sim <- SimCollect('sim_files/')
#' sim
#'
#' # view list of error messages (if there were any raised)
#' SimCollect('sim_files/', select = 'ERRORS')
#'
#' SimClean(dir='sim_files/')
#'
#' }
Expand Down Expand Up @@ -189,12 +193,15 @@ SimCollect <- function(dir=NULL, files = NULL, filename = NULL,
tmp <- try(readRDS(filenames[i]), TRUE)
if(is(tmp, 'try-error'))
stop(c('Could not read file ', filenames[i]))
readin[[i]] <- subset_results(tmp, select=select)
readin[[i]] <- if(!is.null(select) && select %in% c('ERRORS', 'WARNINGS')){
SimExtract(tmp, what=tolower(select))
} else subset_results(tmp, select=select)
if(gc){
rm(tmp)
gc()
}
}
if(!is.null(select) && select %in% c('ERRORS', 'WARNINGS')) return(readin)
extra_info1 <- attr(readin[[1L]], 'extra_info')
ncores <- sum(sapply(readin, function(x) attr(x, 'extra_info')$ncores))
extra_info1[c("seeds", "date_completed", "summarise_list", "stored_results",
Expand Down
6 changes: 5 additions & 1 deletion man/SimCollect.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 761aeda

Please sign in to comment.