From d5f7a0961175e10d31146f8c1d0202ba5bba37ab Mon Sep 17 00:00:00 2001 From: Franz Mohr Date: Sat, 10 Jun 2023 14:46:14 +0200 Subject: [PATCH] Fix coef$max_var condition --- R/add_priors.gvarsubmodels.R | 2 +- R/add_priors.gvecsubmodels.R | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/add_priors.gvarsubmodels.R b/R/add_priors.gvarsubmodels.R index 6a2ce87..189e06c 100644 --- a/R/add_priors.gvarsubmodels.R +++ b/R/add_priors.gvarsubmodels.R @@ -547,7 +547,7 @@ add_priors.gvarsubmodels <- function(object, ..., # Restrict prior variances if (!is.null(coef[["max_var"]])) { - if (any(stats::na.omit(V) > coef[["max_var"]])) { + if (any(stats::na.omit(c(V)) > coef[["max_var"]])) { V[which(V > coef[["max_var"]])] <- coef[["max_var"]] } } diff --git a/R/add_priors.gvecsubmodels.R b/R/add_priors.gvecsubmodels.R index 39936ee..60fead8 100644 --- a/R/add_priors.gvecsubmodels.R +++ b/R/add_priors.gvecsubmodels.R @@ -568,7 +568,7 @@ add_priors.gvecsubmodels <- function(object, ..., # Restrict prior variances if (!is.null(coef[["max_var"]])) { - if (any(stats::na.omit(V) > coef[["max_var"]])) { + if (any(stats::na.omit(c(V)) > coef[["max_var"]])) { V[which(V > coef[["max_var"]])] <- coef[["max_var"]] } }