Produces a deterministic diagram IR string for the requested type: Graphviz
DOT for the six digraph views, dagitty syntax for the causal DAG and SVG for
the venn, rigour and severity views.
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"(the scope overlap of the first three constructs in file order, each taken as the set of its boundary conditions, as an SVG),"rigour"(the checklist as a status grid, as an SVG) or"severity"(the claim-form riskiness of each prediction, thecomputed_severityoftf_severity(), as bars in an SVG).- engine
Deprecated. It has no effect, because the IR does not depend on a rendering engine. Passing it gives a warning, and it will be removed in the next minor release.
Value
A single string ending in a newline: Graphviz DOT for the digraphs,
dagitty syntax for the causal DAG and SVG for the venn,
rigour and severity views.
Details
The nomological net labels each edge with the proposition's id and relation,
as in p1: increases, so that the propositions a hypothesis derives
from can be found on the figure.
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, which dagitty would otherwise read as
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> (outcome_<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. An outcome
reads passed (green) when its passed is TRUE,
failed (red) when it is FALSE and no result recorded
(grey) otherwise. The pipeline lists the predictions from the top down in
file order. The workflow joins each proposition to the construct it acts on
by a dashed edge, so a feedback loop shows.
The Venn view wraps each construct name onto lines of at most 18 characters, and when the theory has more than three constructs, its title says that only the first three are drawn.
The development_roadmap and rigour views score the checklist,
so they stop, as tf_check() does, when a test outcome's passed is
present and not TRUE or FALSE, or when a prediction's
severity is not a finite number from 0 to 1.
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="p1: causes"];
#> }
cat(tf_diagram(theory, "causal_dag"))
#> dag {
#> c_arousal -> c_threat
#> }