Produces a deterministic diagram IR string for the requested type. The
engine argument is accepted but has no effect, because the IR is
engine independent (Graphviz DOT for the two digraphs, dagitty syntax for
the causal DAG).
Arguments
- theory
A theory object (named list).
- type
One of
"nomological_net"(default),"provenance","causal_dag","development_roadmap","pipeline","context"(the theory, its scope, and its rivals),"workflow"(the building-to-testing pipeline),"venn"(construct scope overlap, as an SVG),"rigour"(the checklist as a status grid, as an SVG), or"severity"(per-prediction severity bars, as an SVG).- engine
Rendering engine label, accepted but unused (default
"graphviz").
Value
A single string ending in a newline. Graphviz DOT for the digraphs, dagitty syntax for the causal DAG, and SVG for the Venn.
Details
The causal DAG is read by dagitty and drawn by the apps with Graphviz.
It writes a construct id bare only when the id is made of ASCII letters,
digits and underscores, does not begin with a digit and is not a DOT keyword.
The keywords are node, edge, graph, digraph,
subgraph and strict, in any case. Any other id is
double-quoted, with a double quote inside it escaped by a backslash, so
self-efficacy stays one node where dagitty used to read two. The view
stops when it would write the id node or graph, which dagitty
refuses even quoted.
The pipeline and workflow views give every test outcome a node of its own.
The first outcome of a prediction is result_<id> (outcome_<id> in the
workflow) and each later one result_<id>#<k>, where <k> counts the
prediction's outcomes in file order, so a failed replication is not merged
into an earlier pass. When a prediction has several outcomes, each label
also carries the outcome's date.
Examples
theory <- tf_theory("demo-1", "A demonstration theory") |>
tf_add_construct("c_arousal", "Arousal", "Bodily activation.") |>
tf_add_construct("c_threat", "Perceived threat", "Appraised danger.") |>
tf_add_proposition("p1", "c_arousal", "c_threat", "causes")
cat(tf_diagram(theory, "nomological_net"))
#> digraph nomological_net {
#> graph [rankdir=LR, bgcolor="transparent", fontname="Helvetica", fontsize=11, pad="0.2", nodesep="0.3", ranksep="0.45"];
#> node [fontname="Helvetica", fontsize=11, shape=box, style="rounded,filled", color="#33567A", fillcolor="#F2F6F9", fontcolor="#12283A", penwidth=1.1, margin="0.16,0.1"];
#> edge [fontname="Helvetica", fontsize=10, color="#7B909F", fontcolor="#0F6E6E", arrowsize=0.7];
#> "c_arousal" [label="Arousal", fillcolor="#E4F1F1", color="#1E7B7B"];
#> "c_threat" [label="Perceived threat", fillcolor="#E4F1F1", color="#1E7B7B"];
#> "c_arousal" -> "c_threat" [label="causes"];
#> }
cat(tf_diagram(theory, "causal_dag"))
#> dag {
#> c_arousal -> c_threat
#> }