From 98e94cba5fd7ac16a71763ee56d9a40e9ab4a93f Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 11 Aug 2024 13:03:17 +0200 Subject: [PATCH] fix? --- R/check_dag.R | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/R/check_dag.R b/R/check_dag.R index fbfcdf0bd..b647af546 100644 --- a/R/check_dag.R +++ b/R/check_dag.R @@ -316,17 +316,22 @@ print.check_dag <- function(x, ...) { cat(exposure_outcome_text) cat("\n\n") - for (i in c("direct", "total")) { - if (i == "direct") { - out <- attributes(x)$check_direct - } else { - out <- attributes(x)$check_total + # minimal adjustment sets for direct and total effect identical? + # Then print only once + if (identical(attributes(x)$check_direct$minimal_adjustments, attributes(x)$check_total$minimal_adjustments)) { + .print_dag_results(attributes(x)$check_direct, x, "direct and total", "all") + } else { + for (i in c("direct", "total")) { + if (i == "direct") { + out <- attributes(x)$check_direct + } else { + out <- attributes(x)$check_total + } + .print_dag_results(out, x, i, effect) } - .print_dag_results(out, x, i, effect) } } - .print_dag_results <- function(out, x, i, effect) { # missing adjustements - minimal_adjustment can be a list of different # options for minimal adjustements, so we check here if any of the minimal