Detects variable status given a DAG (exposure, outcome, latent). See dagitty::VariableStatus() for details.

node_status(.dag, as_factor = TRUE, ...)

ggdag_status(.tdy_dag, ..., edge_type = "link_arc", node_size = 16,
  text_size = 3.88, label_size = text_size, text_col = "white",
  label_col = text_col, node = TRUE, stylized = FALSE, text = TRUE,
  use_labels = NULL)

Arguments

.dag, .tdy_dag

input graph, an object of class tidy_dagitty or dagitty

as_factor

treat status variable as factor

...

additional arguments passed to tidy_dagitty()

edge_type

a character vector, the edge geom to use. One of: "link_arc", which accounts for directed and bidirected edges, "link", "arc", or "diagonal"

node_size

size of DAG node

text_size

size of DAG text

label_size

size of label text

text_col

color of DAG text

label_col

color of label text

node

logical. Should nodes be included in the DAG?

stylized

logical. Should DAG nodes be stylized? If so, use geom_dag_nodes and if not use geom_dag_point

text

logical. Should text be included in the DAG?

use_labels

a string. Variable to use for geom_dag_repel_label(). Default is NULL.

Value

a tidy_dagitty with a status column for variable status or a ggplot

Details

node_collider tags variable status and ggdag_collider plots all variable statuses.

Examples

dag <- dagify(l ~ x + y, y ~ x, exposure = "x", outcome = "y", latent = "l") node_status(dag)
#> # A DAG with 3 nodes and 3 edges #> # #> # Exposure: x #> # Outcome: y #> # Latent Variable: l #> # #> # A tibble: 4 x 9 #> name x y direction to xend yend circular status #> <chr> <dbl> <dbl> <fct> <chr> <dbl> <dbl> <lgl> <fct> #> 1 x 10.2 11.7 -> l 10.8 10.9 FALSE exposure #> 2 x 10.2 11.7 -> y 11.2 11.8 FALSE exposure #> 3 y 11.2 11.8 -> l 10.8 10.9 FALSE outcome #> 4 l 10.8 10.9 <NA> <NA> NA NA FALSE latent
ggdag_status(dag)