Skip to content

Commit

Permalink
more informative message
Browse files Browse the repository at this point in the history
  • Loading branch information
philchalmers committed Aug 1, 2024
1 parent a103439 commit a53982e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions R/SimCollect.R
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,13 @@ SimCollect <- function(files = NULL, filename = NULL,
if(!length(nmsw)) nmsw <- 'WARNINGS'
readin <- lapply(readin, function(x) x[ ,!(
grepl('ERROR', colnames(x)) | grepl('WARNINGS', colnames(x))), drop=FALSE])
if(length(unique(sapply(readin, ncol))) > 1L)
stop('Number of columns in the replications not equal')
if(length(unique(sapply(readin, ncol))) > 1L){
tab <- table(sapply(readin, ncol))
pick <- filenames[as.integer(names(which.min(tab))) == sapply(readin, ncol)]
stop(sprintf(c('Number of columns not equal. ',
'The following files had the fewest columns:\n%s'),
paste0(pick, collapse=', ')))
}
Design.ID <- sapply(readin, \(x) SimExtract(x, 'Design.ID'))
if(is.matrix(Design.ID)){
set.index <- rep(1L, ncol(Design.ID))
Expand Down

0 comments on commit a53982e

Please sign in to comment.