export_mechanism | R Documentation |
Exports one or all sufficient cause mechanisms as PNG, PDF, SVG, or PostScript using DiagrammeR::export_graph()
.
export_mechanism(
mechanism,
sc = NULL,
file_name = NULL,
file_type = "png",
title = NULL,
...
)
mechanism |
An object of class |
sc |
A single integer value (can be specified as numeric, e.g., 2 instead of 2L). If provided, a graph is only exported for the specified sufficient cause, e.g., for SC2 if sc = 2. If sc = NULL (default), graphs for all sufficient causes are exported. |
file_name |
The name of the exported file (including it's extension). |
file_type |
The type of file to be exported. Options for graph files
are: |
title |
An optional title for the output graph. |
... |
Arguments passed on to
|
Saves the mechanisms as PNG, PDF, SVG, or PostScript.
DiagrammeR::export_graph()
mechanism()
for information on sufficient cause mechanisms
# Derive mechanisms
mech <- mechanism(scc_rain)
# Export mechanism plot of sufficient cause (sc) 1
if(interactive()){
tmp <- tempfile(fileext = ".png")
export_mechanism(mech, sc = 1, file_name = tmp, title = "Sufficient Cause 1")
unlink(tmp) # delete saved file
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.