|
17 | 17 | #' |
18 | 18 | #' @seealso \code{\link{runArraySimulation}}, \code{\link{SimCollect}} |
19 | 19 | #' |
20 | | -#' @return returns an invisible vector of missing indicies. If no missing |
21 | | -#' then an empty vector is returned |
| 20 | +#' @return returns an invisible list of indices of empty, missing and |
| 21 | +#' empty-and-missing row conditions.. If no missing then an empty list is |
| 22 | +#' returned |
22 | 23 | #' |
23 | 24 | #' @references |
24 | 25 | #' |
@@ -57,17 +58,27 @@ SimCheck <- function(dir = NULL, files = NULL, min = 1L, max = NULL){ |
57 | 58 | max <- attr(tmp, 'extra_info')$number_of_conditions |
58 | 59 | } |
59 | 60 | minmax <- min:max |
60 | | - notin <- !(paste0(filename, '-', minmax, '.rds') %in% files) |
| 61 | + mainlist <- paste0(filename, '-', minmax, '.rds') |
| 62 | + have <- mainlist %in% files |
| 63 | + notin <- !have |
| 64 | + names(have) <- mainlist |
| 65 | + ret <- list() |
61 | 66 | if(any(notin)){ |
| 67 | + ret$Missing_Row_Conditions <- minmax[notin] |
62 | 68 | warning(sprintf('The following row conditions were missing:\n%s\n', |
63 | | - paste0(minmax[notin], collapse=','))) |
| 69 | + paste0(ret$Missing_Row_Conditions, collapse=','))) |
64 | 70 | } |
65 | | - nonzero <- sapply(files, file.size) > 0 |
66 | | - if(any(!nonzero)) |
| 71 | + empty_file <- (sapply(names(have)[have], file.size, USE.NAMES = FALSE) == 0) |
| 72 | + if(any(empty_file)) { |
| 73 | + ret$Empty_Row_Conditions <- minmax[empty_file] |
67 | 74 | warning(sprintf('The following row conditions have nothing saved:\n%s\n', |
68 | | - paste0(minmax[!nonzero], collapse=','))) |
69 | | - ret <- if(any(notin) || any(!nonzero)){ |
70 | | - which(notin | !nonzero) - 1 + min |
| 75 | + paste0(ret$Empty_Row_Conditions, collapse=','))) |
| 76 | + } |
| 77 | + if(any(notin) || any(empty_file)){ |
| 78 | + ret$Empty_Missing_Row_Conditions <- c(minmax[notin], minmax[empty_file]) |> |
| 79 | + unique() |> |
| 80 | + sort() |
71 | 81 | } else integer() |
| 82 | + |
72 | 83 | invisible(ret) |
73 | 84 | } |
0 commit comments