tests/testthat/test-dag_plate.R

test_that("plate is created", {
  graph = dag_create() %>%
    dag_node("Child Node","y") %>%
    dag_node("Parent Node","x") %>%
    dag_edge("x","y") %>%
    dag_plate("Observation","i",
              nodeLabels = "y")
  expect_type(graph, "list")
  expect_equal(graph$nodes_df$descr[1], "Child Node")
  expect_equal(graph$nodes_df$descr[2], "Parent Node")
  expect_equal(graph$edges_df$from, 2)
  expect_equal(graph$edges_df$from, 2)
  expect_equal(graph$edges_df$to, 1)
  expect_equal(graph$edges_df$to, 1)
  expect_equal(graph$plate_index_df$indexDescription, "Observation")
  expect_equal(graph$plate_node_df$nodeID, 1)
})

Try the causact package in your browser

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

causact documentation built on Sept. 8, 2023, 5:46 p.m.