From a872a7113f538bf0a245cf3d493200a1ad3dcd62 Mon Sep 17 00:00:00 2001 From: "Mattan S. Ben-Shachar" Date: Wed, 4 Sep 2024 22:03:08 +0300 Subject: [PATCH] simplify code --- R/utils.R | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/R/utils.R b/R/utils.R index 77e7100fb..374a04fdc 100644 --- a/R/utils.R +++ b/R/utils.R @@ -198,10 +198,6 @@ #' @keywords internal .get_marginaleffects_draws <- function(object) { # errors and checks are handled by marginaleffects - posterior_draws <- attr(object, "posterior_draws") - if (is.null(posterior_draws)) { - insight::format_warning("Could not find posterior draws. The object produced by the `marginaleffects` package was not based on a bayesian model.") - } - as.data.frame(t(posterior_draws)) + insight::check_if_installed("marginaleffects") + data.frame(marginaleffects::posterior_draws(object, shape = "DxP")) } -