Skip to contents

Format an edgelist and send it to dagitty to identify variable adjustment sets.

Usage

qd_todagitty(
  edgelist,
  diagram_type = "dag",
  showplot = FALSE,
  send_global = FALSE,
  dagitty_obj_name = NULL,
  exposure,
  outcome,
  ...
)

Arguments

edgelist

A vector of edge relationships. Must be strictly organized (see example for format).

diagram_type

Character identifying the diagram type. Defaults to "dag", but user can specify another graph type (see dagitty documentation).

showplot

Logical indicating whether to produce a dagitty plot. Defaults to `FALSE`.

send_global

Logical indicating whether to make the dagitty object available in the global environment. Defaults to `FALSE`.

dagitty_obj_name

Character specifying the name of the dagitty object. Only used and required if `send_global = TRUE`.

exposure

Character. Specify exposure of interest. (Required)

outcome

Character. Specifiy outcome of interest. (Required)

...

Pass arguments to [dagitty::adjustmentSets()]. See dagitty documentation for options.

Details

The `exposure` and `outcome` options map to dagitty functions of the same name.

Examples

edges <- c("A -> { B C D }",
           "B -> C",
           "E -> { B C }")
# must pass exposure and outcome arguments to dagitty::adjustmentSets()
qd_todagitty(edges, exposure = "A", outcome = "C")
#>  {}
qd_todagitty(edges, exposure = "A", outcome = "C", type = "minimal")
#>  {}