diff --git a/NAMESPACE b/NAMESPACE index 36a381584..4d59423a9 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -542,7 +542,7 @@ S3method(test_vuong,default) S3method(test_wald,ListNestedRegressions) S3method(test_wald,ListNonNestedRegressions) S3method(test_wald,default) -export(as.dag.check_dag) +export(as.dag) export(binned_residuals) export(check_autocorrelation) export(check_clusterstructure) diff --git a/R/check_dag.R b/R/check_dag.R index 207779407..215f5f89d 100644 --- a/R/check_dag.R +++ b/R/check_dag.R @@ -205,7 +205,10 @@ check_dag.default <- function(..., #' @rdname check_dag #' @export -as.dag.check_dag <- function(x, ...) { +as.dag <- function(x, ...) { + if (!inherits(x, "check_dag")) { + insight::format_error("Input is not of class `check_dag.") + } cat(as.character(x)) } diff --git a/man/check_dag.Rd b/man/check_dag.Rd index 7e842dedb..b0039a142 100644 --- a/man/check_dag.Rd +++ b/man/check_dag.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/check_dag.R \name{check_dag} \alias{check_dag} -\alias{as.dag.check_dag} +\alias{as.dag} \title{Check correct model adjustment for identifying causal effects} \usage{ check_dag( @@ -14,7 +14,7 @@ check_dag( effect = c("all", "total", "direct") ) -as.dag.check_dag(x, ...) +as.dag(x, ...) } \arguments{ \item{...}{One or more formulas, which are converted into \strong{dagitty} syntax.