tests/testthat/test-exogenous.R

set.seed(1234)

test_that("dags identify exogenous variables correctly", {
  exo_dag <- dplyr::filter(node_exogenous(test_dag), exogenous == "exogenous")
  exo_vars <- unique(pull_dag_data(exo_dag)$name)
  expect_equal(exo_vars, dagitty::exogenousVariables(pull_dag(test_dag)))
  p <- ggdag_exogenous(test_dag)
  expect_doppelganger("ggdag_exogenous() identifies v, w1, w2 as exogenous", p)
})

Try the ggdag package in your browser

Any scripts or data that you put into this service are public.

ggdag documentation built on Sept. 11, 2024, 6:12 p.m.