From 40b12f74f9afd611b806e4437301927dbc1fe865 Mon Sep 17 00:00:00 2001 From: AQLT Date: Sat, 9 Mar 2024 18:32:12 +0100 Subject: [PATCH] correction of `get_jmodel()` with empty multiprocessings --- NEWS.md | 4 +++- R/get_jmodel.R | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/NEWS.md b/NEWS.md index 84c995f6..1fb57420 100644 --- a/NEWS.md +++ b/NEWS.md @@ -6,12 +6,14 @@ - correction when importing models containing ramp regressors when the frequency is not 12 (monthly). +- correction of `get_jmodel()` with empty multiprocessings. + # RJDemetra 0.2.5 - `proc_data()` update to export more data from Java object. -- seasonality Kurskal-Wallis test corrected (issue #128). +- seasonality Kurskal-Wallis test corrected (issue #128). - `vcov()` correction when matrix NULL and new parameter `component`. diff --git a/R/get_jmodel.R b/R/get_jmodel.R index 659d101b..11d42112 100644 --- a/R/get_jmodel.R +++ b/R/get_jmodel.R @@ -13,7 +13,7 @@ get_jmodel.workspace <- function(x, workspace, multiprocessings <- get_all_objects(x) nb_mp <- length(multiprocessings) - result <- lapply(1:nb_mp, function(i){ + result <- lapply(seq_len(nb_mp), function(i){ if (progress_bar) cat(sprintf("Multiprocessing %i on %i:\n", i, nb_mp)) get_jmodel(multiprocessings[[i]], @@ -34,7 +34,7 @@ get_jmodel.multiprocessing <- function(x, workspace, if (progress_bar) pb <- txtProgressBar(min = 0, max = nb_sa_objs, style = 3) - result <- lapply(1:nb_sa_objs, function(i){ + result <- lapply(seq_len(nb_sa_objs), function(i){ res <- get_jmodel(all_sa_objects[[i]], workspace = workspace, userdefined = userdefined) if (progress_bar)