# function executes without error or warning
eval_capture_conditions(letters[1:2])
# an error is thrown
res <- eval_capture_conditions(stop("Example Error!"))
res
captured_condition_as_message(res)
# if more than one warning is returned, all are saved
eval_capture_conditions({
warning("Warning 1")
warning("Warning 2")
letters[1:2]
})
# messages are not printed to the console
eval_capture_conditions({
message("A message!")
letters[1:2]
})
Run the code above in your browser using DataLab