From 5c06ad9165199f1b6a2e8ecf1dada1f6f7c2e0d6 Mon Sep 17 00:00:00 2001 From: aho Date: Tue, 17 Oct 2023 18:51:07 +0200 Subject: [PATCH] Correct dat name of work_pieces (internal usage only); Add message when multiple datasets are requested and return_vars has common dimensions --- R/Start.R | 12 ++++++++++++ R/zzz.R | 7 ++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/R/Start.R b/R/Start.R index b0ad40d..89f87e9 100644 --- a/R/Start.R +++ b/R/Start.R @@ -1777,6 +1777,18 @@ Start <- function(..., # dim = indices/selectors, } } } + + # Return info about return_vars when dat > 1 + if (length(dat) > 1 & length(common_return_vars) > 0) { + .message("\n", "[ATTENTION]", + paste0("According to parameter 'return_vars', the inner dimensions: ", + paste(names(common_return_vars), collapse = ', '), + ", are common among all the datasets. Please be sure that ", + "this is expected to avoid potential wrong results, and ", + "verify the outputs carefully."), + "\n", indent = 1) + } + #//////////////////////////////////////////// # This part was above where return_vars is seperated into return_vars and common_return_vars diff --git a/R/zzz.R b/R/zzz.R index 1e56e29..f098a3b 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -980,7 +980,12 @@ build_work_pieces <- function(work_pieces, i, selectors, file_dims, inner_dims, if (x %in% names(depending_file_dims)) { vector_to_pick <- file_to_load_indices[depending_file_dims[[x]]] } - selectors[file_dims][[x]][[vector_to_pick]][file_to_load_indices[x]] + if (x != found_pattern_dim) { + selectors[[x]][[vector_to_pick]][file_to_load_indices[x]] + } else { + # dat_dim only has one value in each work_piece + selectors[[x]][[vector_to_pick]] + } }) names(file_selectors) <- file_dims work_piece[['file_selectors']] <- file_selectors -- GitLab