assert | R Documentation |
Throw error if condition false
assert(cond, msg = "Assertion failed.", A = NULL)
cond |
Logical test |
msg |
Error message to be displayed if |
A |
values to format |
The error message if cond == FALSE
, nothing otherwise
Waldir Leoncio
minVal <- 7 x <- 26 assert(minVal < x) # should return nothing maxVal <- 13 ## Not run: assert((minVal < x) && (x < maxVal)) assert(x == "a", "x is %s", class(x)) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.