diff --git a/R/Analogs.R b/R/Analogs.R index f0ebd610721f0a7ddcabfbec495436bb4d12ef26..230102da2f7df5cd1e439750242f6aae72482904 100644 --- a/R/Analogs.R +++ b/R/Analogs.R @@ -480,6 +480,10 @@ Analogs <- function(exp, obs, exp_lats, exp_lons, obs_lats, obs_lons, grid_exp, if (fun_analog == "wmean") { weight <- 1 / dist res <- apply(res, c(1,2), function(x) weighted.mean(x, weight)) + } else if (fun_analog == "min") { + res<-res[,,which.min(dist)] + } else if (fun_analog == "max") { + res<-res[,,which.max(dist)] } else { res <- apply(res, c(1,2), fun_analog) }