canonicalize: Canonicalize a DAG

Canonicalize DAGsR Documentation

Canonicalize a DAG

Description

Takes an input graph with bidirected edges and replaces every bidirected edge x <-> y with a substructure x <- L -> y, where L is a latent variable. See dagitty::canonicalize() for details. Undirected edges are not currently supported in ggdag.

Usage

node_canonical(.dag, ...)

ggdag_canonical(
  .tdy_dag,
  ...,
  edge_type = "link_arc",
  node_size = 16,
  text_size = 3.88,
  label_size = text_size,
  text_col = "white",
  label_col = text_col,
  use_edges = TRUE,
  use_nodes = TRUE,
  use_stylized = FALSE,
  use_text = TRUE,
  use_labels = NULL,
  label = NULL,
  text = NULL,
  node = deprecated(),
  stylized = deprecated()
)

Arguments

.dag, .tdy_dag

input graph, an object of class tidy_dagitty or dagitty

...

additional arguments passed to tidy_dagitty()

edge_type

The type of edge, one of "link_arc", "link", "arc", "diagonal".

node_size

The size of the nodes.

text_size

The size of the text.

label_size

The size of the labels.

text_col

The color of the text.

label_col

The color of the labels.

use_edges

A logical value. Include a ⁠geom_dag_edges*()⁠ function? If TRUE, which is determined by edge_type.

use_nodes

A logical value. Include geom_dag_point()?

use_stylized

A logical value. Include geom_dag_node()?

use_text

A logical value. Include geom_dag_text()?

use_labels

A logical value. Include geom_dag_label_repel()?

label

The bare name of a column to use for geom_dag_label_repel(). If use_labels = TRUE, the default is to use label.

text

The bare name of a column to use for geom_dag_text(). If use_text = TRUE, the default is to use name.

node

Deprecated.

stylized

Deprecated.

Value

a tidy_dagitty that includes L or a ggplot

Examples

dag <- dagify(y ~ x + z, x ~ ~z)

ggdag(dag)

node_canonical(dag)
ggdag_canonical(dag)


malcolmbarrett/ggdag documentation built on March 8, 2024, 5:49 p.m.