Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Sep 18, 2024
1 parent 700311f commit 28c881f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
9 changes: 8 additions & 1 deletion R/check_dag.R
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,14 @@
#' exposure = ~x,
#' adjusted = ~ b + c
#' )
#' dag
#'
#' # if not provided, "outcome" is taken from first formula, same for "exposure"
#' # thus, we can simplify the above expression to
#' check_dag(
#' y ~ x + b + c,
#' x ~ b,
#' adjusted = ~ b + c
#' )
#'
#' # use specific layout for the DAG
#' dag <- check_dag(
Expand Down
9 changes: 8 additions & 1 deletion man/check_dag.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions tests/testthat/test-check_dag.R
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,10 @@ test_that("check_dag, formula-interface", {
adjusted = ~ b + c
)
expect_identical(attributes(dag)$adjusted, c("b", "c"))
dag2 <- check_dag(
y ~ x + b + c,
x ~ b,
adjusted = ~ b + c
)
expect_identical(dag, dag2)
})

0 comments on commit 28c881f

Please sign in to comment.