powered by
These functions are for starting and ending a sequence of assertr assertions and overriding the default behavior of assertr halting execution on the first error.
chain_start(data, store_success = FALSE)chain_end(data, success_fun = success_continue, error_fun = error_report)
chain_end(data, success_fun = success_continue, error_fun = error_report)
A data frame
If TRUE each successful assertion is stored in chain.
Function to call if assertion passes. Defaults to returning data.
data
Function to call if assertion fails. Defaults to printing a summary of all errors.
For more information, read the relevant section in this package's vignette using, vignette("assertr")
vignette("assertr")
For examples of possible choices for the success_fun and error_fun parameters, run help("success_and_error_functions")
success_fun
error_fun
help("success_and_error_functions")
library(magrittr) mtcars %>% chain_start() %>% verify(nrow(mtcars) > 10) %>% verify(mpg > 0) %>% insist(within_n_sds(4), mpg) %>% assert(in_set(0,1), am, vs) %>% chain_end()
Run the code above in your browser using DataLab