Description Usage Arguments Details Value Author(s) See Also Examples
If any of the expressions in ‘...’ are not all TRUE, stop is called, producing an error message defined by the msg parameter.
1 |
... |
any number of ‘logical’ R expressions, which should
evaluate to |
msg |
Error message. |
The function is adapted from the stopifnot
function, with the
difference that the error message can be defined the programmer. With
haltifnot
error message can be more informative, which is desired for
diagnostic and user-interation purposes.
NULL
if all statements in ...
are TRUE
Jitao David Zhang <jitao_david.zhang@roche.com>
1 2 3 4 5 6 7 8 9 10 | haltifnot(1==1, all.equal(pi, 3.14159265), 1<2) ## all TRUE
m <- matrix(c(1,3,3,1), 2,2)
haltifnot(m == t(m), diag(m) == rep(1,2)) ## all TRUE
op <- options(error = expression(NULL))
# "disable stop(.)" << Use with CARE! >>
haltifnot(all.equal(pi, 3.141593), 2 < 2, all(1:10 < 12), "a" < "b",
msg="not all conditions are TRUE. Please contact the devleoper")
options(op)# revert to previous error handler
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.