latch | R Documentation |
Latch an error or a warning to an object
to indicate an issue associated with it.
These can later be checked with is.e()
and is.w()
, and can also be resolve()
.
latch.e(obj, error)
latch.w(obj, warning)
unlatch(obj)
obj |
Object to latch the error or warning onto. |
error, warning |
Error or warning, the
output of |
latche
and latchw
: latch an error or a warning.
unlatch
: unlatch any error or warning.
x <- 1
problematic <- latch.e(x, e("Not right"))
is.e(problematic)
do_sth_with_x <- function(x){
resolve(x)
x + 1
}
if(interactive()){
do_sth_with_x(x)
do_sth_with_x(problematic)
}
unlatch(problematic)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.