From e9c3668d032380cd1ba19826a8fec89432a74642 Mon Sep 17 00:00:00 2001 From: eduzenli Date: Tue, 30 Jul 2024 12:52:22 +0200 Subject: [PATCH 1/2] logreg na issue fixed --- R/LogisticReg.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/LogisticReg.R b/R/LogisticReg.R index a14f3d9..5fca822 100644 --- a/R/LogisticReg.R +++ b/R/LogisticReg.R @@ -680,7 +680,7 @@ LogisticReg <- function(exp, obs, exp_cor = NULL, exp_lats, exp_lons, obs_lats, pred_vals_ls <- list() for (j in 1:length(lm1)) { window <- ((j-1)*k_out+1):((j-1)*k_out + k_out) # test the daily data of the corresponding year - if (all(is.na(df[window, ]))) { + if (any(apply(df[window, ], 2, function (x) all(is.na (x))))) { pred_vals_ls[[j]] <- array(rep(NA, length(window) * (length(probs_cat) + 1)), dim = c(length(window), length(probs_cat) + 1)) } else { -- GitLab From 464f6763e34e17565d75572dfee3c18aeb42a38b Mon Sep 17 00:00:00 2001 From: eduzenli Date: Tue, 30 Jul 2024 15:38:55 +0200 Subject: [PATCH 2/2] . --- R/LogisticReg.R | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/R/LogisticReg.R b/R/LogisticReg.R index 5fca822..439a38b 100644 --- a/R/LogisticReg.R +++ b/R/LogisticReg.R @@ -673,9 +673,8 @@ LogisticReg <- function(exp, obs, exp_cor = NULL, exp_lats, exp_lons, obs_lats, require(plyr) if (loocv) { - - # The error: "Error: Results must have the same dimensions." can - # appear when the number of sdates is insufficient + # The error: "Error: Results must have the same dimensions." can + # appear when the number of sdates is insufficient pred_vals_ls <- list() for (j in 1:length(lm1)) { -- GitLab