node_exogenous tags exogenous variables given an exposure and outcome. ggdag_exogenous plots all exogenous variables. See dagitty::exogenousVariables() for details.

node_exogenous(.dag, ...)

ggdag_exogenous(.tdy_dag, ..., node_size = 16, text_size = 3.88,
  edge_type = "link_arc", 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

...

additional arguments passed to tidy_dagitty()

node_size

size of DAG node

text_size

size of DAG text

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"

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 an exogenous column for exogenous variables or a ggplot

Examples

dag <- dagify(y ~ x1 + x2 + x3, b ~ x1 + x2) ggdag_exogenous(dag)
node_exogenous(dag)
#> # A DAG with 5 nodes and 5 edges #> # #> # A tibble: 7 x 9 #> name x y direction to xend yend circular exogenous #> <chr> <dbl> <dbl> <fct> <chr> <dbl> <dbl> <lgl> <chr> #> 1 x1 12.7 18.1 -> b 11.6 17.8 FALSE exogenous #> 2 x1 12.7 18.1 -> y 13.5 17.0 FALSE exogenous #> 3 x2 12.2 16.8 -> b 11.6 17.8 FALSE exogenous #> 4 x2 12.2 16.8 -> y 13.5 17.0 FALSE exogenous #> 5 x3 14.7 16.5 -> y 13.5 17.0 FALSE exogenous #> 6 b 11.6 17.8 <NA> <NA> NA NA FALSE <NA> #> 7 y 13.5 17.0 <NA> <NA> NA NA FALSE <NA>