| verbose {fuj} | R Documentation |
Verbose
Description
Simple verbose condition handling
Usage
verbose(
...,
.fill = getOption("fuj.verbose.fill"),
.label = getOption("fuj.verbose.label"),
.verbose = getOption("fuj.verbose", getOption("verbose"))
)
make_verbose(opt)
Arguments
... |
A message to display. When |
.fill |
When |
.label |
A label to prefix the message with (controlled through
|
.verbose |
When |
opt |
An option to use in lieu of |
Details
verbose() can be safely placed in scripts to signal additional
message conditions. verbose() can be controlled with
options("verbose") (the default) and an override,
options("fuj.verbose"). The latter can be set to a function whose result
will be used for conditional evaluation.
make_verbose() allows for the creation of a custom verbose function.
Value
None, called for its side-effects. When conditions are met, will
signal a verboseMessage condition.
Examples
op <- options(verbose = FALSE)
verbose("will not show")
options(verbose = TRUE)
verbose("message printed")
verbose("multiple lines ", "will be ", "combined")
options(op)
op <- options(fuj.verbose = function() TRUE)
verbose("function will evaluate")
verbose(NULL) # nothing
verbose(NULL, "something")
verbose(if (FALSE) {
"`if` returns `NULL` when not `TRUE`, which makes for additional control"
})
options(op)
# make your own verbose
verb <- make_verbose("fuj.foo.bar")
verb("will not show")
options(fuj.foo.bar = TRUE)
verb("will show")