A General Message and Error Reporting System
Overview
Provides a system for reporting messages, which provides certain useful features over the standard R system, such as the incorporation of output consolidation, message filtering, assertions, expression substitution, automatic generation of stack traces for debugging, and conditional reporting based on the current "output level". Messages are signalled as classed R conditions, so that calling code can decide how serious a situation is, rather than the function which detects it having to be told in advance.
- Every message is now signalled as a classed R condition before it is reported. The class vector always includes one derived from the level of the message, such as "reportrInfo", so existing code gains conditions without any changes. See ?reportrCondition.
- The report(), flag() and assert() functions gain a "class" argument, which attaches further classes of the caller's choosing to a message, and a "call" argument giving the call to associate with the condition. Classed messages are signalled even when the output level means that they will not be reported.
- The new reportAs() function changes the level at which particular classes of condition are reported, so that the caller can decide how serious a situation is.
Show all changes in 2.0.0Hide the rest of the changes in 2.0.0
- The new fallback() function raises an error which the caller may demote, returning a value of the signalling function's choosing instead. Only errors raised this way can be demoted, since others provide no value to continue with.
- withReportrHandlers() now also accepts named arguments mapping condition classes to levels or to handler functions, and reportrHandlers() installs the same translations for a whole session using globalCallingHandlers(), which requires R 4.0.0 or later. The package itself needs only R 3.5.0.
- Conditions translated by withReportrHandlers() keep the classes of R's original condition, which is also stored in their "original" element, so a handler further out can still match them by class.
- Messages can now be written to files, connections and functions as well as, or instead of, the terminal, using setOutputTargets() with toTerminal(), toFile() and toFunction(). Each output target may have its own level threshold and prefix format. See ?targets.
- The new "%t" prefix escape expands to the current time, formatted according to the new "reportrTimeFormat" option.
- The new "reportrBaseClasses" option, if TRUE, makes conditions at level Warning inherit from "warning", and those at level Info and below from "message", so that suppressWarnings() and suppressMessages() affect them.
- The new level OL$Ignore, below OL$Debug, can be used with reportAs() to suppress a class of condition entirely.
BREAKING CHANGES
- Errors raised by report() and friends are now caught by try() and by tryCatch(expr, error=...), since the conditions signalled inherit from "error". Previously they could not be caught at all. Code which wrapped a reporting function in try() to guard against other errors may now find it catching reportr errors as well.
- An error is now fatal whatever the current output level, and whether or not its message is filtered out of the output. Previously either could prevent it from taking effect.
- OL$Fatal now ends execution in the same way as OL$Error. Previously it was reported but not acted upon.
- The reportrStackFilterIn and reportrStackFilterOut options have been removed.
- An assertion whose expression itself reports an error is now a failed assertion, and reports the message given to assert(), rather than ending execution. This matches what already happened when the expression raised an error in R's own way.
- flag() signals its condition at the point where the message is flagged, rather than when it is eventually reported. A flagged message at level Error or above is therefore fatal at that point.
- Flagged messages, including warnings consolidated by withReportrHandlers(), are now written with the usual prefix format, rather than always with "%L: ". With the default format they are therefore indented to show the call depth at which they were flagged.
- The "prefixFormat" argument to report(), ask() and assert() is deprecated, since prefix formats now belong to output targets. The value "", which suppresses the prefix, is still honoured, and is equivalent to the new "prefix=FALSE"; any other value is ignored, with a warning the first time.
- ask() now asks its question in a non-interactive session, such as a script run with Rscript, if standard input is a terminal, reading the answer from there. Previously it always returned its default in such sessions. Setting the new "reportrAskInScripts" option to FALSE restores the old behaviour.
- The package now requires R 3.5.0 or later.
BUG FIXES
- Expression substitution is no longer applied twice to consolidated messages reported by reportFlags(), or to messages passed to assert(). Text containing "#{...}" is now reported literally in these cases, as intended.
- Message text arriving from outside reportr, via withReportrHandlers(), is no longer passed through es(). Previously a foreign message containing the "#{...}" syntax would have it evaluated.
- The environment used for expression substitution is now passed explicitly rather than being inferred from the call depth, so it remains correct regardless of how a message reaches the reporting code.
- withReportrHandlers() now returns the value of its expression invisibly if that value was invisible, so wrapping an expression no longer changes what the console prints.
- Stack traces for messages reported at top level no longer contain a spurious "NA" entry.
- The "%f" prefix escape no longer causes an error when a message is reported at top level; it expands to an empty string instead.
- Namespace-qualified calls, such as reportr::report(), no longer add spurious depth to the "%d" prefix escape or to stack traces, and "%f" now gives just the function name for a qualified call.
From NEWS in the release
Install
Health
- OK13 OK2026-08-05
- NOTE12 OK, 1 NOTE2026-08-01
- OK14 OK2026-03-10
Documentation
- Help pages
- 7includes a package overview page
- Examples that run
- 83%5 run in a plain check · 1 never run
- Exported functions with examples
- 86%
- Documented parameters
- 96%
- Return-value docs
- 86%
- Help pages citing references
- 0%
Downloads
Repository
- PRs merged (all time)
- not measured
- Median days to close, 50 most recently updated closed issues
- 3
- Median days to close, 50 most recently updated closed PRs
- not measured
Stars over time
Forks over time
Releases over time
Issues over time
Commits over time
3 development-tooling and community-health practices detected across 2 families in the upstream repository
Checks run against github.com/jonclayden/reportr on 2026-10-22.
The R CMD check workflow runs on Linux and Windows
Dependencies
Installing reportr adds 1 package (1 with compiled code, 488 KB of source tarballs). Heaviest: ore 488 KB.
Code & Tests
People & History
Pick two releases to compare their code metrics.
- 2.0.0Latest2026-10-13 · current release · diff ↗ ·
added 9 exports
fallback, getOutputTargets, reportAs, reportrCondition, reportrHandlers, setOutputTargets, toFile, toFunction, toTerminal - RR 4.6.0 released · 2026-04-24
- RR 4.5.0 released · 2025-04-11
- 1.3.12025-03-30 · diff ↗
- RR 4.4.0 released · 2024-04-24
- RR 4.3.0 released · 2023-04-21
- RR 4.2.0 released · 2022-04-22
- RR 4.1.0 released · 2021-05-18
- RR 4.0.0 released · 2020-04-24
- RR 3.6.0 released · 2019-04-26
- 1.3.0
- RR 3.5.0 released · 2018-04-23
- RR 3.4.0 released · 2017-04-21
- 1.2.22016-10-06 · diff ↗
- RR 3.3.0 released · 2016-05-03
- 1.2.12016-04-01 · diff ↗
Show 15 earlier eventsHide 15 earlier events
- 1.2.02015-10-14 · diff ↗ ·
removed 1 export
pattern:^[^\\.]added 9 exports
OL, ask, clearFlags, flag, getOutputLevel, report, reportFlags, setOutputLevel, withReportrHandlers - RR 3.2.0 released · 2015-04-16
- RR 3.1.0 released · 2014-04-10
- 1.1.22014-03-12 · diff ↗
- 1.1.12014-02-26 · diff ↗
- 1.1.02013-12-04 · diff ↗
- 1.0.12013-07-23 · diff ↗
- RR 3.0.0 released · 2013-04-03
- RR 2.15.0 released · 2012-03-30
- RR 2.14.0 released · 2011-10-31
- 1.0.02011-10-25 · diff ↗
- 0.2.0
- RR 2.13.0 released · 2011-04-13
- 0.1.02010-10-27
- RR 2.12.0 released · 2010-10-15
Package metadata
- First published
- 2010-10-27
- Total releases
- 13 / 16 yrs
- License
- GPL-2 OSI
- Minimum R
- ≥ 3.5.0
- Download size
- 43 KB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("reportr")This package has no citation file, so citation() returns this entry built from DESCRIPTION.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-25, which the citation names so these numbers can be found later. More on citing and the projects behind them.