Currently R provides a stopifnot() function for making assertions. It would be useful to also have stopif(), which would stop if any of the arguments is any TRUE. stopif() would help in avoiding double-negatives, which make reading code difficult, e.g.
stopifnot(!is.na(x)) vs. stopif(is.na(x))
Hi, it seems like your problem is easy to fix by modifying the stopifnot code.
Relevant code here : https://svn.r-project.org/R/trunk/src/library/base/R/stop.R
Basically shows that stopifnot checks if each element is piecewise FALSE and has a ! on the conditional for checking. If we just remove this and modify the string that is displayed upon finding something FALSE to something that will be shown for getting true, we are done.
(In reply to Amur Ghose from comment #1)
> Hi, it seems like your problem is easy to fix by modifying the stopifnot
Yes, I figured this was such obvious that I didn't mention it in the bug description. I have already had such a function modified from stopifnot for years in our company internal package of miscellaneous functions. I'd just like to see it in base R. There's no difficulty implementing it, it's just a question of whether the conservative maintainers see value to warrant the addition.