The behavior of functions like assert, assert_rows,
insist, insist_rows, verify when the assertion
passes or fails is configurable via the success_fun
and error_fun parameters, respectively.
The success_fun parameter takes a function that takes
the data passed to the assertion function as a parameter. You can
write your own success handler function, but there are two
provided by this package:
success_continue - just returns the data that was
passed into the assertion function
success_logical - returns TRUE
The error_fun parameter takes a function that takes
the data passed to the assertion function as a parameter. You can
write your own error handler function, but there are a few
provided by this package:
error_stop - Prints a summary of the errors and
halts execution.
error_report - Prints all the information available
about the errors and halts execution.
error_append - Attaches the errors to a special
attribute of data and returns the data. This is chiefly
to allow assertr errors to be accumulated in a pipeline so that
all assertions can have a chance to be checked and so that all
the errors can be displayed at the end of the chain.
error_logical - returns FALSE
just_warn - Prints a summary of the errors but does
not halt execution, it just issues a warning.
warn_report - Prints all the information available
about the errors but does not halt execution, it just issues a warning.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | success_logical(data, ...)
success_continue(data, ...)
error_stop(errors, data = NULL, warn = FALSE, ...)
just_warn(errors, data = NULL)
error_report(errors, data = NULL, warn = FALSE, ...)
warn_report(errors, data = NULL)
error_append(errors, data = NULL)
error_return(errors, data = NULL)
error_logical(errors, data = NULL, ...)
|
data |
A data frame |
... |
Further arguments passed to or from other methods |
errors |
A list of objects of class |
warn |
If TRUE, assertr will issue a warning instead of an error |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.