Skip to contents

Renders the result of tf_check() as a string. format = "json" returns valid, pretty-printed JSON. format = "html" returns an HTML fragment in which every interpolated value is escaped. It gives the checklist score with its range and the gate, then what the score describes and what the gate checks, then a table of the items with the criterion each applies, its status and score and the works from which the criterion is drawn. The two items whose failure blocks the gate have (blocker) after their ids, as in the dossier. Any other format stops, and so does a theory that tf_check() refuses.

Usage

tf_report(theory, format = "json")

Arguments

theory

A theory object (named list).

format

One of "json" (default) or "html".

Value

A single string.

Examples

theory <- tf_theory("demo-1", "A demonstration theory") |>
  tf_add_construct("c_arousal", "Arousal", "Bodily activation.") |>
  tf_add_prediction("h1", "Arousal precedes threat appraisal.", "directional")
cat(tf_report(theory, format = "json"))
#> {
#>   "theory_id": "demo-1",
#>   "schema_version": "1.1",
#>   "checklist_version": "3.1",
#>   "maturity": "building",
#>   "aggregate_score": 22,
#>   "aggregate_range": [13, 34],
#>   "coverage": 0.82,
#>   "gate": "blocked",
#>   "n_blockers_failed": 1,
#>   "items": [
#>     {
#>       "id": "falsifiability",
#>       "status": "pass",
#>       "score": 1,
#>       "weight": 0.15,
#>       "severity_if_fail": "blocker",
#>       "citation": "Popper (1959); Bacharach (1989)"
#>     },
#>     {
#>       "id": "precision",
#>       "status": "warn",
#>       "score": 0,
#>       "weight": 0.1,
#>       "severity_if_fail": "warning",
#>       "citation": "Meehl (1967, 1990a)"
#>     },
#>     {
#>       "id": "risk_severity",
#>       "status": "warn",
#>       "score": 0.3,
#>       "weight": 0.1,
#>       "severity_if_fail": "warning",
#>       "citation": "Popper (1959); Meehl (1967, 1990b)"
#>     },
#>     {
#>       "id": "parsimony",
#>       "status": "n/a",
#>       "score": null,
#>       "weight": 0.08,
#>       "severity_if_fail": "warning",
#>       "citation": "Lakatos (1970); Meehl (1990a)"
#>     },
#>     {
#>       "id": "non_redundancy",
#>       "status": "n/a",
#>       "score": null,
#>       "weight": 0.1,
#>       "severity_if_fail": "warning",
#>       "citation": "Kelley (1927); Le et al. (2010); Lawson & Robins (2021)"
#>     },
#>     {
#>       "id": "construct_clarity",
#>       "status": "warn",
#>       "score": 0,
#>       "weight": 0.08,
#>       "severity_if_fail": "warning",
#>       "citation": "Suddaby (2010); Cronbach & Meehl (1955); Flake & Fried (2020)"
#>     },
#>     {
#>       "id": "scope",
#>       "status": "warn",
#>       "score": 0,
#>       "weight": 0.06,
#>       "severity_if_fail": "warning",
#>       "citation": "Whetten (1989); Bacharach (1989)"
#>     },
#>     {
#>       "id": "logical_why",
#>       "status": "warn",
#>       "score": 0,
#>       "weight": 0.08,
#>       "severity_if_fail": "warning",
#>       "citation": "Sutton & Staw (1995); Whetten (1989)"
#>     },
#>     {
#>       "id": "causal_testability",
#>       "status": "warn",
#>       "score": 0,
#>       "weight": 0.06,
#>       "severity_if_fail": "warning",
#>       "citation": "Rohrer (2018); Eronen & Bringmann (2021)"
#>     },
#>     {
#>       "id": "diagnosticity",
#>       "status": "warn",
#>       "score": 0,
#>       "weight": 0.06,
#>       "severity_if_fail": "warning",
#>       "citation": "Platt (1964); Fiedler (2017)"
#>     },
#>     {
#>       "id": "formalisation",
#>       "status": "warn",
#>       "score": 0,
#>       "weight": 0.05,
#>       "severity_if_fail": "warning",
#>       "citation": "Robinaugh et al. (2021); Guest & Martin (2021)"
#>     },
#>     {
#>       "id": "derivation_chain",
#>       "status": "fail",
#>       "score": 0,
#>       "weight": 0.08,
#>       "severity_if_fail": "blocker",
#>       "citation": "Scheel et al. (2021); Szollosi et al. (2020)",
#>       "not_checked": [],
#>       "phenomena_not_checked": []
#>     }
#>   ]
#> }