The goal of slap is simplify error handling.
pak::pak("tadascience/slap")
library(dplyr) library(slap) # suppose you have a function that throws an error boom <- function() stop("An error occured in boom()") # and you want to use it in e.g. dplyr::summarise() # summarise(mtcars, mpg = boom()) # if you want to catch it and rethrow an error that is more # meaningful to you, one way is to use withCallingHandlers() withCallingHandlers( summarise(mtcars, mpg = boom()), error = function(err) { cli::cli_abort("ouch", parent = err) } ) # but that's kind of boring, so instead you can use the # slap operator %!% to slap away the eror summarise(mtcars, mpg = boom()) %!% "ouch" # or the double slap operator %!!% if you don't want to keep the parent error summarise(mtcars, mpg = boom()) %!!% "ouch"
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4