Prints [OK] or [FAIL] followed by a description, and records the
result so that check_summary() can report how many checks passed. Use it
to write your own checks while exploring a design or an analysis.
Arguments
- what
Description of the check, e.g.
"every entry planted once".- ok
Logical.
TRUEwhen the check passes; anything else (includingNA) counts as a failure.- section
Optional label for grouping checks, e.g.
"p-rep". Defaults to the label set withcheck_section().- note
Logical. If
TRUE, the check is informational: it prints[NOTE]instead of[FAIL]whenokis notTRUEand is not counted as a failure.
Examples
check_reset()
#> Ready to start: no earlier checks to clear. The checks you run from now on will be counted together.
check_result("two plus two is four", 2 + 2 == 4)
#> [OK] two plus two is four
check_result("a deliberate failure", FALSE, section = "demo")
#> [FAIL] a deliberate failure
check_summary()
#>
#> 1 of 2 checks passed
#>
#> By section:
#> section checks passed failed notes
#> (no section) 1 1 0 0
#> demo 1 0 1 0
#>
#> Failed checks (not correct):
#> section check
#> demo a deliberate failure
check_reset()
#> Earlier checks cleared (2 checks: 1 passed, 1 failed). Ready to start new checks.