From 26b37823c984623ef58d40b072e8e8c944ac3be4 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 11 Aug 2024 21:24:34 +0200 Subject: [PATCH] fix --- R/check_dag.R | 3 ++- man/check_dag.Rd | 1 + tests/testthat/_snaps/check_dag.md | 16 ++++++++-------- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/R/check_dag.R b/R/check_dag.R index b647af546..e197e7b86 100644 --- a/R/check_dag.R +++ b/R/check_dag.R @@ -66,6 +66,7 @@ #' to remove cycles from the model. #' #' @section Direct and total effects: +#' #' The direct effect of an exposure on an outcome is the effect that is not #' mediated by any other variable in the model. The total effect is the sum of #' the direct and indirect effects. The function checks if the model is correctly @@ -413,7 +414,7 @@ print.check_dag <- function(x, ...) { if (effect %in% c("all", i)) { cat(insight::print_color(insight::format_message( - paste0("Identification of {.i ", i, "} effects\n\n") + paste0("Identification of ", i, " effects\n\n") ), "blue")) cat(msg) cat("\n\n") diff --git a/man/check_dag.Rd b/man/check_dag.Rd index 98e254f94..c5153ffb0 100644 --- a/man/check_dag.Rd +++ b/man/check_dag.Rd @@ -101,6 +101,7 @@ to remove cycles from the model. \section{Direct and total effects}{ + The direct effect of an exposure on an outcome is the effect that is not mediated by any other variable in the model. The total effect is the sum of the direct and indirect effects. The function checks if the model is correctly diff --git a/tests/testthat/_snaps/check_dag.md b/tests/testthat/_snaps/check_dag.md index 3bc856d55..2f2548a78 100644 --- a/tests/testthat/_snaps/check_dag.md +++ b/tests/testthat/_snaps/check_dag.md @@ -7,7 +7,7 @@ - Outcome: y - Exposure: x - Identification of {.i direct and total} effects + Identification of direct and total effects Model is correctly specified. No adjustment needed to estimate the direct and total effect of `x` on `y`. @@ -23,7 +23,7 @@ - Exposure: x - Adjustment: b - Identification of {.i direct and total} effects + Identification of direct and total effects Model is correctly specified. All minimal sufficient adjustments to estimate the direct and total effect were done. @@ -38,7 +38,7 @@ - Outcome: y - Exposure: x - Identification of {.i direct and total} effects + Identification of direct and total effects Incorrectly adjusted! To estimate the direct and total effect, at least adjust for `b`. @@ -55,7 +55,7 @@ - Exposure: x - Adjustment: c - Identification of {.i direct and total} effects + Identification of direct and total effects Incorrectly adjusted! To estimate the direct and total effect, at least adjust for `b` and `c`. @@ -72,7 +72,7 @@ - Exposure: x - Adjustment: c - Identification of {.i direct and total} effects + Identification of direct and total effects Incorrectly adjusted! To estimate the direct and total effect, at least adjust for `b` and `c`. @@ -89,7 +89,7 @@ - Exposure: wt - Adjustments: cyl, disp and gear - Identification of {.i direct and total} effects + Identification of direct and total effects Model is correctly specified. All minimal sufficient adjustments to estimate the direct and total effect were done. @@ -104,7 +104,7 @@ - Outcome: exam - Exposure: podcast - Identification of {.i direct and total} effects + Identification of direct and total effects Incorrectly adjusted! To estimate the direct and total effect, at least adjust for one of the following sets: @@ -125,7 +125,7 @@ - Exposure: podcast - Adjustments: alertness and prepared - Identification of {.i direct and total} effects + Identification of direct and total effects Model is correctly specified. All minimal sufficient adjustments to estimate the direct and total effect were done.