Raises error if expression is FALSE anywhereSource:
Meant for use in a data analysis pipeline, this function will just return the data it's supplied if all the logicals in the expression supplied are TRUE. If at least one is FALSE, this function will raise a error, effectively terminating the pipeline early
verify( data, expr, success_fun = success_continue, error_fun = error_stop, skip_chain_opts = FALSE, obligatory = FALSE, defect_fun = defect_append, description = NA )
A data frame, list, or environment
A logical expression
Function to call if assertion passes. Defaults to returning
Function to call if assertion fails. Defaults to printing a summary of all errors.
error_funare used even if assertion is called within a chain.
If TRUE and assertion failed the data is marked as defective. For defective data, all the following rules are handled by
Function to call when data is defective. Defaults to skipping assertion and storing info about it in special attribute.
Custom description of the rule. Is stored in result reports and data.
By default, the
data is returned if predicate assertion
is TRUE and and error is thrown if not. If a non-default
error_fun is used, the return
values of these function will be returned.
For examples of possible choices for the
error_fun parameters, run
vignette("assertr") for how to use this in context