From a53982e8fda11afd9f14b6bf237a24c6de950684 Mon Sep 17 00:00:00 2001 From: Robert Philip Chalmers Date: Wed, 31 Jul 2024 22:17:27 -0400 Subject: [PATCH] more informative message --- R/SimCollect.R | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/R/SimCollect.R b/R/SimCollect.R index 38c74791..2d47ef3f 100644 --- a/R/SimCollect.R +++ b/R/SimCollect.R @@ -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))