Wrapper | R Documentation |
The wrap
function wraps a value inside a Wrapper
container,
possibly incorporating wrapped messages, too.
Wrapper(
value,
errors = list(),
warnings = list(),
info = list(),
include = list(),
...
)
is.Wrapper(x)
errors |
List of error messages (list, optional) |
warnings |
List of warning messages (list, optional) |
info |
List of informational messages (list, optional) |
include |
A list of already-wrapped objects, who's errors, warnings, and infos should be included in this wrapper |
x |
A value to be wrapped |
quiet |
If TRUE, print the enclosed messages, if any, before extracting the enclosed value (logical) |
The unwrap
function extracts the value from the container.
Unless quiet = TRUE
, it will print the wrapped, associated messages, if any,
before returning that extracted value (so the message are not ignored).
As a convenience to the caller, the errors, warnings, and info may be supplied as character vectors (or even NULL), but they will be coerced to lists and stored as lists.
Wrapper
and wrap
eturn a list with class Wrapper
.
unwrap
returns the value wrapped inside the Wrapper container.
w <- wrap(pi, error = "Help me!", warnings = "Just chillin'")
# Extract the wrapped value
unwrap(w)
# Extract the wrapped value and print the wrapped messages
unwrap(w, quiet = FALSE)
# Piggy back the error messages
wrap(pi, error = "Pi error", include = list( wrap("foo", error = "Foo error") ))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.