| result | R Documentation |
result monad for later evaluation.Use result on functions whose outcomes are not known in advance or not
safe to be examined. The function will not be evaluated until the monad is
explicitly called.
result(.fn, detect_warning = TRUE, fail_on_warning = TRUE)
.fn |
function to wrap |
detect_warning |
logical, whether to detect warnings; note |
fail_on_warning |
logical, whether to treat warnings as |
function that returns a result object of subclass
success or failure
crashy <- function() stop("Go no further")
safely_call_crashy <- result(crashy)
safely_call_crashy() |> is_failure()
calculate <- function(x, y) x + y
safely_calculate <- result(calculate)
safely_calculate(1, 2) |> value()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.