diff --git a/R/LogisticReg.R b/R/LogisticReg.R index a14f3d99322de3bc9af2235d0da3c715c590513e..439a38bafec162d6cba34b664204269d8679baa9 100644 --- a/R/LogisticReg.R +++ b/R/LogisticReg.R @@ -673,14 +673,13 @@ 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)) { 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 {