makeDAG | R Documentation |
Save directed acyclic graphs (DAGs) generated in DiagrammeR and export them to pdf, png, or svg format. Users may optionally choose to view the DAG without saving or to embed it in an RMarkdown document.
makeDAG( graphcode = NULL, dagname = NULL, filetype = "pdf", text.nodes = NULL, box.nodes = NULL, solid.edges = NULL, dashed.edges = NULL, footnotes = NULL, direction = "LR", embed = FALSE, ... )
graphcode |
Partial graphViz code object, which will give you the most control over the appearance of your DAG. |
dagname |
A path with which to name your DAG file, if |
filetype |
Output file format. Select from |
text.nodes |
A string containing the plain text nodes, separated by spaces. |
box.nodes |
A string containing the boxed nodes, separated by spaces. |
solid.edges |
A string specifying the paths you want to draw between measured covariates. Example: |
dashed.edges |
A string specifying paths containing unmeasured covariates. |
footnotes |
Add a footnote to the bottom of the graph. |
direction |
Specify the direction of diagram flow. Defaults to |
embed |
For use within R chunks in RMarkdown only. You will probably want to have the |
... |
Pass arguments to interior functions for PNG or SVG files. For instance, specify |
This is not a true DAG package in the sense that it will not prevent the inclusion of feedback loops or bidirectional arrows. It's meant mostly to create reasonable-looking DAGs quickly and easily with a minimum of layout or formatting code. DiagrammeR in general does a pretty good job at layout. Those interested in DAGs might check out other R packages like dagR or dagitty, both of which I've yet to explore in detail.
Suggestions and issue reports welcome at https://github.com/jrgant/quickDAG/issues!
A fair amount of the heavy lifting here is done thanks to code snippets from users HJAllen and puterleat on the following thread: https://github.com/rich-iannone/DiagrammeR/issues/133
Packages used: DiagrammeR, DiagrammeRsvg, rsvg
# Using your own graph code # Examples have been removed, as makeDAG() is now deprecated.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.