tests/testthat/test-exogenous.R

set.seed(1234)

test_that("dags identify exogenous variables correctly", {
  exo_vars <- unique(filter(node_exogenous(test_dag), exogenous == "exogenous")$data$name)
  expect_equal(exo_vars, dagitty::exogenousVariables(test_dag$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 May 31, 2023, 7:48 p.m.